-
Notifications
You must be signed in to change notification settings - Fork 461
[dev-v5] Add SortableList #4487
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
base: dev-v5
Are you sure you want to change the base?
Conversation
|
|
||
| @if (ItemTemplate is not null) | ||
| { | ||
| <div @ref="@_element" id="@Id" class="@ClassValue" style="@StyleValue"> |
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.
should add AdditionalAttributes
| /// Gets or sets the list of items to be displayed in a sortable list. | ||
| /// </summary> | ||
| [Parameter, AllowNull] | ||
| public IEnumerable<TItem> Items { get; set; } |
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.
since this allows null should it be IEnumerable<TItem>? instead?
| /// Gets or sets whether elements are cloned instead of moved. Set Pull to "clone" to enable this. | ||
| /// </summary> | ||
| [Parameter] | ||
| public bool Clone { get; set; } = false; |
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.
false is the default value and don't need to be specified
| /// Set to true to use an element with classname `.sortable-grab` as the handle. | ||
| /// </summary> | ||
| [Parameter] | ||
| public bool Handle { get; set; } = false; |
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.
false is the default value and don't need to be specified
| /// Gets or sets the border width on the list. Must be a valid CSS measurement. | ||
| /// </summary> | ||
| [Parameter] | ||
| public string? ListBorderWidth { get; set; } |
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'm not sure about all of this parameters for changing basic CSS. What do you think @dvoituron ?
| /// <summary /> | ||
| protected override async Task OnAfterRenderAsync(bool firstRender) | ||
| { | ||
|
|
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.
remove empty line
| public bool Disabled { get; set; } = false; | ||
| } | ||
|
|
||
| public List<Item> items1 = Enumerable.Range(1, 10).Select(i => new Item { Id = i, Name = $"Item {i}" }).ToList(); |
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.
we should remove public and private from the demos to keep them lighter and be consistent with the other demos
- Add tests - Update docs - Update styles
Unit Tests
Details on your Workflow / Core Tests page. |
This pull request introduces a new
FluentSortableListcomponent for Blazor Fluent UI, providing a drag-and-drop sortable list powered by SortableJS. The update includes the component implementation, JavaScript interop, documentation, and a comprehensive set of usage examples demonstrating sorting, moving, cloning, filtering, disabling, drag handles, and fallback behaviors.Although SortableJS does not come with a11y support, we enhanced the
FluentSortableListcomponent to support keyboard accessibility. Users can navigate through the list items using the arrow up/down keys. An item can be grabbed and released by using the space bar or pressing enter. A grabbed item can then be moved in the list with the arrow up and down keys.The component also provides appropriate ARIA attributes to enhance screen reader support.
The most important changes are:
Component Implementation and Integration
FluentSortableListBlazor component, which renders a sortable list using a providedItemTemplateand exposes event hooks for sorting and moving items. (FluentSortableList.razor)FluentSortableList.ts)sortablejsas a new dependency in the project. (package.json)Documentation
FluentSortableList.md)Examples and Demos
.razorfiles showcasing different use cases:Minor Improvements
FluentDataGrid.razor.cs)