-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#3242 - WIP of in-table filtering and sorting
- Loading branch information
1 parent
cf7bbb2
commit 2ec4863
Showing
30 changed files
with
513 additions
and
476 deletions.
There are no files selected for viewing
22 changes: 22 additions & 0 deletions
22
src/IoTHub.Portal.Client/Components/Commons/DeviceModelDataGridFilter.razor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
@* <MudStack Spacing="0"> | ||
<MudCheckBox T="bool" Label="Select All" | ||
Size="Size.Small" | ||
Value="@selectAll" ValueChanged="@SelectAll" /> | ||
<MudStack Spacing="0"> | ||
@foreach (var item in @Items) | ||
{ | ||
<MudStack Row="true" AlignItems="AlignItems.Center" Wrap="Wrap.NoWrap"> | ||
<MudCheckBox T="bool" | ||
Size="Size.Small" | ||
Value="@(selectedItems.Contains(item))" | ||
ValueChanged="@((value) => SelectedChanged(value, item))" /> | ||
<img src="@(item.Image)" alt="@(item.Image) device model image" /> | ||
<MudText>@item.Name</MudText> | ||
</MudStack> | ||
} | ||
</MudStack> | ||
<MudStack Row="true"> | ||
<MudButton Color="@Color.Primary" OnClick="@(() => ApplyFilterAsync(Context))">Filter</MudButton> | ||
</MudStack> | ||
</MudStack> | ||
*@ |
68 changes: 68 additions & 0 deletions
68
src/IoTHub.Portal.Client/Components/Commons/DeviceModelDataGridFilter.razor.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
//// Copyright (c) CGI France. All rights reserved. | ||
//// Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
|
||
//namespace IoTHub.Portal.Client.Components.Commons | ||
//{ | ||
// using Enums; | ||
// using MudBlazor; | ||
|
||
// public partial class DeviceModelDataGridFilter | ||
// { | ||
// private bool filterOpen = false; | ||
// private bool selectAll = true; | ||
// private HashSet<DeviceModelDto> selectedItems = new(); | ||
// private HashSet<DeviceModelDto> filterItems = new(); | ||
// private FilterDefinition<DeviceModelDto> filterDefinition; | ||
|
||
|
||
// [Parameter] public IEnumerable<DeviceModelDto> Items { get; set; } | ||
|
||
// //[Parameter] public FilterContext<DeviceModelDto> Context {get;} | ||
|
||
// protected override Task OnInitializedAsync() | ||
// { | ||
// this.selectedItems = Items.ToHashSet(); | ||
// this.filterItems = Items.ToHashSet(); | ||
// this.filterDefinition = new FilterDefinition<DeviceModelDto> | ||
// { | ||
// FilterFunction = x => this.filterItems.Contains(x) | ||
// }; | ||
|
||
// return base.OnInitializedAsync(); | ||
// } | ||
|
||
// //private void OpenFilter() | ||
// //{ | ||
// // this.filterOpen = true; | ||
// //} | ||
|
||
// private void SelectedChanged(bool value, DeviceModelDto item) | ||
// { | ||
// _ = value ? this.selectedItems.Add(item) : this.selectedItems.Remove(item); | ||
|
||
// this.selectAll = this.selectedItems.Count == Items.Count(); | ||
// } | ||
|
||
// //private async Task ApplyFilterAsync(FilterContext<DeviceModelDto> context) | ||
// //{ | ||
// // filterItems = selectedItems.ToHashSet(); | ||
// // //_icon = _filterItems.Count == Items.Count() ? Icons.Material.Outlined.FilterAlt : Icons.Material.Filled.FilterAlt; | ||
// // await context.Actions.ApplyFilterAsync(filterDefinition); | ||
// // filterOpen = false; | ||
// //} | ||
|
||
// private void SelectAll(bool value) | ||
// { | ||
// selectAll = value; | ||
|
||
// if (value) | ||
// { | ||
// selectedItems = Items.ToHashSet(); | ||
// } | ||
// else | ||
// { | ||
// selectedItems.Clear(); | ||
// } | ||
// } | ||
// } | ||
//} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
// Copyright (c) CGI France. All rights reserved. | ||
// Licensed under the MIT license. See LICENSE file in the project root for full license information. | ||
|
||
global using Microsoft.AspNetCore.Components; | ||
global using IoTHub.Portal.Models.v10; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.