Skip to content
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

added attribute for Hide Id #123

Open
wants to merge 17 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Client/Components/EntityTable/AddEditModal.razor
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<DataAnnotationsValidator />
<CustomValidation @ref="_customValidation" />
<MudGrid>
@if (!IsCreate)
@if (!IsCreate && !HideId)
{
<MudItem xs="12" md="6">
<MudTextField Value="Id" ReadOnly DisableUnderLine Label="@L[$"{EntityName} Id"]" />
Expand Down
2 changes: 2 additions & 0 deletions src/Client/Components/EntityTable/AddEditModal.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ public partial class AddEditModal<TRequest> : IAddEditModal<TRequest>
private CustomValidation? _customValidation;

public bool IsCreate => Id is null;
[Parameter]
public bool HideId { get; set; }

public void ForceRender() => StateHasChanged();

Expand Down
5 changes: 4 additions & 1 deletion src/Client/Components/EntityTable/EntityTable.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ public partial class EntityTable<TEntity, TId, TRequest>

[Parameter]
public RenderFragment<TRequest>? EditFormContent { get; set; }
[Parameter]
public bool HideId { get; set; }

[CascadingParameter]
protected Task<AuthenticationState> AuthState { get; set; } = default!;
Expand Down Expand Up @@ -185,7 +187,8 @@ private async Task InvokeModal(TEntity? entity = default)
{
{ nameof(AddEditModal<TRequest>.EditFormContent), EditFormContent },
{ nameof(AddEditModal<TRequest>.OnInitializedFunc), Context.EditFormInitializedFunc },
{ nameof(AddEditModal<TRequest>.EntityName), Context.EntityName }
{ nameof(AddEditModal<TRequest>.EntityName), Context.EntityName },
{ nameof(AddEditModal<TRequest>.HideId), HideId}
};

TRequest requestModel;
Expand Down
2 changes: 1 addition & 1 deletion src/Client/Pages/Catalog/Brands.razor
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<FshTitle Title="@L["Brands"]" Description="@L["Manage Brands."]" />

<EntityTable TEntity="BrandDto" TId="Guid" TRequest="UpdateBrandRequest" Context="@Context">
<EntityTable TEntity="BrandDto" TId="Guid" TRequest="UpdateBrandRequest" Context="@Context" HideId="true">

<EditFormContent>
<MudItem xs="12" md="6">
Expand Down