Add "Clear file list" button to AttachDocuments component

This commit is contained in:
Thorsten Sommer 2025-10-28 09:41:45 +01:00
parent 1f82155b13
commit 45ab5338b4
Signed by: tsommer
GPG Key ID: 371BBA77A02C0108
2 changed files with 10 additions and 0 deletions

View File

@ -12,4 +12,7 @@
}
</MudPaper>
</MudLink>
<MudButton OnClick="@(async () => await this.ClearAllFiles())" Variant="Variant.Filled" Color="Color.Info" Class="mt-2" StartIcon="@Icons.Material.Filled.Delete">
@T("Clear file list")
</MudButton>
</div>

View File

@ -100,6 +100,13 @@ public partial class AttachDocuments : MSGComponentBase
await this.OnChange(this.DocumentPaths);
}
private async Task ClearAllFiles()
{
this.DocumentPaths.Clear();
await this.DocumentPathsChanged.InvokeAsync(this.DocumentPaths);
await this.OnChange(this.DocumentPaths);
}
private void SetDragClass() => this.dragClass = $"{DEFAULT_DRAG_CLASS} mud-border-primary border-4";
private void ClearDragClass() => this.dragClass = DEFAULT_DRAG_CLASS;