mirror of
https://github.com/chylex/Minecraft-Phantom-Panel.git
synced 2024-12-22 16:42:50 +01:00
35 lines
726 B
Plaintext
35 lines
726 B
Plaintext
@implements IDisposable
|
|
|
|
<EditForm EditContext="Model.EditContext" OnSubmit="Submit">
|
|
<DataAnnotationsValidator />
|
|
<CascadingValue Value="this">
|
|
@ChildContent
|
|
</CascadingValue>
|
|
</EditForm>
|
|
|
|
@code {
|
|
|
|
[Parameter, EditorRequired]
|
|
public FormModel Model { get; set; } = null!;
|
|
|
|
[Parameter, EditorRequired]
|
|
public EventCallback<EditContext> OnSubmit { get; set; }
|
|
|
|
[Parameter]
|
|
public RenderFragment? ChildContent { get; set; }
|
|
|
|
public event EventHandler? BeforeSubmit;
|
|
|
|
private async Task Submit(EditContext obj) {
|
|
BeforeSubmit?.Invoke(this, EventArgs.Empty);
|
|
if (obj.Validate()) {
|
|
await OnSubmit.InvokeAsync(obj);
|
|
}
|
|
}
|
|
|
|
public void Dispose() {
|
|
BeforeSubmit = null;
|
|
}
|
|
|
|
}
|