Skip to content

Commit

Permalink
Changes according to SQ
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander van Delft committed Dec 13, 2024
1 parent afb39c9 commit 480060d
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 24 deletions.
2 changes: 1 addition & 1 deletion COMET.Web.Common/Components/CardView/CardField.cs
Original file line number Diff line number Diff line change
Expand Up @@ -138,4 +138,4 @@ protected override void BuildRenderTree(RenderTreeBuilder builder)
}
}
}
}
}
2 changes: 1 addition & 1 deletion COMET.Web.Common/Components/CardView/CardView.razor
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
------------------------------------------------------------------------------->
@namespace COMET.Web.Common.Components
@namespace COMET.Web.Common.Components.CardView
@typeparam T
@inherits DisposableComponent

Expand Down
36 changes: 14 additions & 22 deletions COMET.Web.Common/Components/CardView/CardView.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,15 @@
// </copyright>
// --------------------------------------------------------------------------------------------------------------------

namespace COMET.Web.Common.Components
namespace COMET.Web.Common.Components.CardView
{
using COMET.Web.Common.Components.CardView;
using System.Linq.Dynamic.Core;

using FastMember;

using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Web.Virtualization;

using System.Linq.Dynamic.Core;

/// <summary>
/// Component used to show a CardView based on a specific type
/// </summary>
Expand Down Expand Up @@ -64,30 +62,30 @@ public partial class CardView<T> : DisposableComponent
public float MinWidth { get; set; } = 250;

/// <summary>
/// Gets or sets a collection of propertynames of type <see cref="T"/> to perform search on
/// Gets or sets a collection of propertynames of type <see cref="T"/>to perform search on

Check warning on line 65 in COMET.Web.Common/Components/CardView/CardView.razor.cs

View workflow job for this annotation

GitHub Actions / build

XML comment has cref attribute 'T' that refers to a type parameter

Check warning on line 65 in COMET.Web.Common/Components/CardView/CardView.razor.cs

View workflow job for this annotation

GitHub Actions / build

XML comment has cref attribute 'T' that refers to a type parameter

Check warning on line 65 in COMET.Web.Common/Components/CardView/CardView.razor.cs

View workflow job for this annotation

GitHub Actions / Build

XML comment has cref attribute 'T' that refers to a type parameter

Check warning on line 65 in COMET.Web.Common/Components/CardView/CardView.razor.cs

View workflow job for this annotation

GitHub Actions / Build

XML comment has cref attribute 'T' that refers to a type parameter

Check warning on line 65 in COMET.Web.Common/Components/CardView/CardView.razor.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

XML comment has cref attribute 'T' that refers to a type parameter

Check warning on line 65 in COMET.Web.Common/Components/CardView/CardView.razor.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

XML comment has cref attribute 'T' that refers to a type parameter
/// </summary>
public HashSet<string> SearchFields { get; set; } = [];
public HashSet<string> SearchFields { get; private set; } = [];

/// <summary>
/// Gets or sets a collection of propertynames of type <see cref="T"/> to perform sorting on

Check warning on line 70 in COMET.Web.Common/Components/CardView/CardView.razor.cs

View workflow job for this annotation

GitHub Actions / build

XML comment has cref attribute 'T' that refers to a type parameter

Check warning on line 70 in COMET.Web.Common/Components/CardView/CardView.razor.cs

View workflow job for this annotation

GitHub Actions / build

XML comment has cref attribute 'T' that refers to a type parameter

Check warning on line 70 in COMET.Web.Common/Components/CardView/CardView.razor.cs

View workflow job for this annotation

GitHub Actions / Build

XML comment has cref attribute 'T' that refers to a type parameter

Check warning on line 70 in COMET.Web.Common/Components/CardView/CardView.razor.cs

View workflow job for this annotation

GitHub Actions / Build

XML comment has cref attribute 'T' that refers to a type parameter

Check warning on line 70 in COMET.Web.Common/Components/CardView/CardView.razor.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

XML comment has cref attribute 'T' that refers to a type parameter

Check warning on line 70 in COMET.Web.Common/Components/CardView/CardView.razor.cs

View workflow job for this annotation

GitHub Actions / Analyze (csharp)

XML comment has cref attribute 'T' that refers to a type parameter
/// </summary>
public SortedSet<string> SortFields { get; set; } = [string.Empty];
public SortedSet<string> SortFields { get; private set; } = [string.Empty];

/// <summary>
/// Gets or sets a value indication that sorting is allowed
/// </summary>
public bool AllowSort { get; set; } = false;
public bool AllowSort { get; set; }

/// <summary>
/// Gets or sets a value indication that searching is allowed
/// </summary>
public bool AllowSearch { get; set; } = false;
public bool AllowSearch { get; set; }

/// <summary>
/// hold a reference to the previously selected Item.
/// Typically used to check for changes in Items collection
/// </summary>
private ICollection<T> previousItems = null;
private ICollection<T> previousItems;

/// <summary>
/// A reference to the <see cref="Virtualize{T}"/> component for loading items
Expand Down Expand Up @@ -219,22 +217,16 @@ private void OnSearchTextChanged(string value)
/// <param name="cardField">the <see cref="CardField{T}"/></param>
internal void InitializeCardField(CardField<T> cardField)
{
if (cardField.AllowSort)
if (cardField.AllowSort && this.SortFields.Add(cardField.FieldName))
{
if (this.SortFields.Add(cardField.FieldName))
{
this.AllowSort = true;
this.StateHasChanged();
}
this.AllowSort = true;
this.StateHasChanged();
}

if (cardField.AllowSearch)
if (cardField.AllowSearch && this.SearchFields.Add(cardField.FieldName))
{
if (this.SearchFields.Add(cardField.FieldName))
{
this.AllowSearch = true;
this.StateHasChanged();
}
this.AllowSearch = true;
this.StateHasChanged();
}
}

Expand Down

0 comments on commit 480060d

Please sign in to comment.