mirror of https://github.com/abpframework/abp.git
csharpabpc-sharpframeworkblazoraspnet-coredotnet-coreaspnetcorearchitecturesaasdomain-driven-designangularmulti-tenancy
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
62 lines
1.4 KiB
62 lines
1.4 KiB
using System;
|
|
using System.Threading.Tasks;
|
|
using Blazorise;
|
|
using Microsoft.AspNetCore.Components;
|
|
|
|
namespace Volo.Abp.BlazoriseUI.Components
|
|
{
|
|
public partial class SubmitButton : ComponentBase
|
|
{
|
|
protected bool Submiting { get; set; }
|
|
|
|
[Parameter]
|
|
public string Form { get; set; }
|
|
|
|
[Parameter]
|
|
public ButtonType Type { get; set; } = ButtonType.Submit;
|
|
|
|
[Parameter]
|
|
public Color Color { get; set; } = Color.Primary;
|
|
|
|
[Parameter]
|
|
public bool PreventDefaultOnSubmit { get; set; } = true;
|
|
|
|
[Parameter]
|
|
public bool Block { get; set; }
|
|
|
|
[Parameter]
|
|
public bool? Disabled { get; set; }
|
|
|
|
[Parameter]
|
|
public EventCallback Clicked { get; set; }
|
|
|
|
[Parameter]
|
|
public RenderFragment ChildContent { get; set; }
|
|
|
|
protected bool IsDisabled
|
|
=> Disabled == true || Submiting;
|
|
|
|
protected bool IsLoading
|
|
=> Submiting;
|
|
|
|
protected virtual async Task OnClickedHandler()
|
|
{
|
|
try
|
|
{
|
|
Submiting = true;
|
|
|
|
await Clicked.InvokeAsync(null);
|
|
}
|
|
catch (Exception)
|
|
{
|
|
throw;
|
|
}
|
|
finally
|
|
{
|
|
Submiting = false;
|
|
|
|
await InvokeAsync(StateHasChanged);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|