-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
MudTabs: Add Drag and Drop functionality #11267
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
MudTabs: Add Drag and Drop functionality #11267
Conversation
This commit introduces a new section in `TabsPage.razor` to describe the drag-and-drop feature for tabs, including an example component `TabsDragAndDropExample`. Modifications in `MudTabs.razor` support this functionality by updating the `MudDropContainer` and `MudDropZone` for proper styling and integration. Additionally, a new property `DropZoneClassnames` is added in `MudTabs.razor.cs` to define CSS classes for the drop zone, ensuring UI updates with `Rerender` and `StateHasChanged`. These changes enhance the interactivity of the tab component, allowing users to reorder tabs dynamically.
Codecov ReportAttention: Patch coverage is
❌ Your patch status has failed because the patch coverage (76.47%) is below the target coverage (100.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## dev #11267 +/- ##
==========================================
- Coverage 91.12% 91.10% -0.02%
==========================================
Files 465 465
Lines 14412 14429 +17
Branches 2790 2792 +2
==========================================
+ Hits 13133 13146 +13
- Misses 641 643 +2
- Partials 638 640 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
@richardhauer Take a look at this one, my ItemUpdated method still worked so I didn't want to change it. However I want to make sure it's in line with the new sort stuff you added. |
@versile2 I like your feature, I've been meaning to integrate It seems like you've already had a look at my feature, but it essentially intercepts the loop to provide sorting control, where I think your In the event a user has set a sorting expression I think you will get un-expected results if you reorder the list items, or rather no observable result as the sorting overrides the natural item order. Logically, I expect that manually sortable tabs would be mutually exclusive to expression-sorted. I suggest these features cannot both be used together. An analyzer could be used to detect this and warn the user. If we want to support both features at once I think a shadow list is needed that supports some additional properties needed to determine the intersection of automatic sorting and manual override, as in "sort all the tabs this way in the event they have no 'manual override index' but if they do use that instead" sort of thing. As a step 0 I think mutually exclusive is reasonable. Sorting should be auto or manual, not both. (imho) |
|
|
Sorry for the delay, I don't use the tab component so I'm not able to get up to speed and review it right now but will try to at some point if no one else is available. |
|
This is a great start, the drag and drop I was looking for is in the advanced setup when you allow users to create new tabs and then allow them to drag and drop in the left panel. I'll make a test of this change to see what happens! Much appreciated getting this in as I have other use case for this ability. |
Let me know I did quite a bit of testing but there's always a chance I missed something. |
|
This is looking great, definitely what I was looking for in the issue reported. I'm looking forward to implementing this one! |
|
@danielchalmers Any time to look at this one maybe this weekend? |
danielchalmers
left a comment
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.
Great work!



Description
Resolves #10704
Add Drag and Drop functionality to MudTabs by allowing MudTabPanels to be re-ordered. Implemented Drag and Drop using the built in MudDropContainer. It can be enabled by using EnableDragAndDrop on MudTabs. Enabled ondragenter to scroll when dragging over built in scroll icons.
Includes a minor synchronization bugfix when someone uses ActivatePanel not properly rendering the tabs until the next update.
MudTabsDragAndDrop.mp4
How Has This Been Tested?
Unit Test added to verify basic styles and ItemDropped functionality.
Visual Testing underway.
Type of Changes
Checklist
dev).