-
Notifications
You must be signed in to change notification settings - Fork 314
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
[FluentSortableList] New component #1334
Conversation
Group name default to null Fix Cloning example sorting Fix esproj?
Azure Static Web Apps: Your stage site is ready! Visit it here: https://black-pebble-0dc79cb03-1334.westeurope.3.azurestaticapps.net |
Azure Static Web Apps: Your stage site is ready! Visit it here: https://black-pebble-0dc79cb03-1334.westeurope.3.azurestaticapps.net |
Azure Static Web Apps: Your stage site is ready! Visit it here: https://black-pebble-0dc79cb03-1334.westeurope.3.azurestaticapps.net |
Azure Static Web Apps: Your stage site is ready! Visit it here: https://black-pebble-0dc79cb03-1334.westeurope.3.azurestaticapps.net |
Azure Static Web Apps: Your stage site is ready! Visit it here: https://black-pebble-0dc79cb03-1334.westeurope.3.azurestaticapps.net |
Azure Static Web Apps: Your stage site is ready! Visit it here: https://black-pebble-0dc79cb03-1334.westeurope.3.azurestaticapps.net |
Azure Static Web Apps: Your stage site is ready! Visit it here: https://black-pebble-0dc79cb03-1334.westeurope.3.azurestaticapps.net |
- Simplify needed template information by icluding classes in the component logic - Replace Filter with ItemFilter (Func) - Add css variables - Update docs page - Add a first test
Azure Static Web Apps: Your stage site is ready! Visit it here: https://black-pebble-0dc79cb03-1334.westeurope.3.azurestaticapps.net |
- Doc updates
Azure Static Web Apps: Your stage site is ready! Visit it here: https://black-pebble-0dc79cb03-1334.westeurope.3.azurestaticapps.net |
Azure Static Web Apps: Your stage site is ready! Visit it here: https://black-pebble-0dc79cb03-1334.westeurope.3.azurestaticapps.net |
1 similar comment
Azure Static Web Apps: Your stage site is ready! Visit it here: https://black-pebble-0dc79cb03-1334.westeurope.3.azurestaticapps.net |
Azure Static Web Apps: Your stage site is ready! Visit it here: https://black-pebble-0dc79cb03-1334.westeurope.3.azurestaticapps.net |
Azure Static Web Apps: Your stage site is ready! Visit it here: https://black-pebble-0dc79cb03-1334.westeurope.3.azurestaticapps.net |
Fluent Sortable List
An implementation of the SortableJS library for Blazor Fluent UI. Allows for reordering elements within a list using drag and drop. Based on Burke Holland's article and code. re-used with permission.
How to use it in your own project
index.html
/_Layout.cshtml
/App.razor
file. You can either download from the SortableJS website or use a CDN:Use the
FluentSortableList.razor
in your page/app.Add the SortableList component to your page and define the SortableItemTemplate...
@context.
when omitted)The
ItemTemplate
can contain any markup or components that you want. Each item is automatically wrapped in adiv
with class "sortable-item". The following CSS classes can be used to split the drag functionality from the content:By using these seperate classes, you can define and style areas for grabbing and displaying.. See the examples on how this can be used.
API
Parameters
Only the component's own parameters are described here , not the parameters inherited from base classes
ItemTemplate
:RenderFragment<TItem>?
(default: null) - The template to be used to define each sortable item in the list. Use the @context parameter to access the item and its properties.Items
:IEnumerable<TItem>
(default: null) - The list of items to be displayed in the list.Group
: string (default: null) - Used for dragging between lists. Set the group to the same value on both lists to enable.Clone
: bool (default: false) - Used when you want to clone elments into a list instead of moving them. Setclone
to true.Drop
: bool (default: true) - Set to false to disable dropping from another list onto the current list.Sort
: bool (default: true) - Disable sorting within a list by setting tofalse
.Handle
: bool (default: false) - Set to true to use the.sortable-grab
CSS class name you set on an element in theItemTemplate
to function as the drag handle. In the default situation the whole item acts as a drragable.ItemFilter
:Func<TItem, bool>?
(default: null) - Sepcify a lambda to indicate which item(s) from theItems
parameter should be filtered out of the dragging capabilityMethods
OnUpdate
(Optional): The method to be called when the list is updated. You can name this method whatever you like, but it expects aFluentSortableListEventArgs
(containingOldIndex
andNewIndex
) parameter when the drag and drop occurs.OnRemove
(Optional): The method to be called when an item is removed from a list. This method is useful for handling the drop even between multiple lists. LikeOnUpdate
, it expects aFluentSortableListEventArgs
(containingOldIndex
andNewIndex
) parameterYou will need to handle all events yourself. If you don't handle any events, no sort or move will happen as Blazor needs to make the changes to the underlying data structures so it can re-render the list.
Here is an example of how to reorder your list when the OnUpdate is fired...