Add project files.
This commit is contained in:
@@ -0,0 +1,88 @@
|
||||
@using Elsa.Studio.DomInterop.Contracts
|
||||
@using Elsa.Studio.Localization.Time.Components
|
||||
@using Elsa.Studio.Models
|
||||
|
||||
<MudSimpleTable Outlined="true" Striped="false" Dense="true" Elevation="0" Bordered="false">
|
||||
<tbody>
|
||||
@{
|
||||
var data = HideEmptyValues
|
||||
? Data.Where(x => !string.IsNullOrWhiteSpace(x.Text)).ToList()
|
||||
: Data;
|
||||
}
|
||||
@if (data.Any())
|
||||
{
|
||||
@foreach (var item in data)
|
||||
{
|
||||
<tr>
|
||||
<td style="width: 200px;">@item.Label</td>
|
||||
<td style="width: 50px;">
|
||||
<MudIconButton Icon="@Icons.Material.Outlined.ContentCopy" Size="Size.Small" Title="Copy" OnClick="@(() => OnCopyClicked(item.Text!))" Disabled="@(string.IsNullOrWhiteSpace(item.Text))"/>
|
||||
</td>
|
||||
<td>
|
||||
@if (!string.IsNullOrWhiteSpace(item.Link))
|
||||
{
|
||||
<MudLink Typo="Typo.body2" Href="@item.Link">@item.Text</MudLink>
|
||||
}
|
||||
else if (item.OnClick != null)
|
||||
{
|
||||
<MudLink Typo="Typo.body2" OnClick="@item.OnClick">@item.Text</MudLink>
|
||||
}
|
||||
else
|
||||
{
|
||||
@if (item.Label == "Created" || item.Label == "Updated" || item.Label == "Finished")
|
||||
{
|
||||
<span><Timestamp Value="@Convert.ToDateTime(item.Text)"></Timestamp></span>
|
||||
}
|
||||
else
|
||||
{
|
||||
<span>@item.Text</span>
|
||||
}
|
||||
}
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (ShowNoDataAlert)
|
||||
{
|
||||
<MudAlert Severity="Severity.Normal" Dense="true" Variant="Variant.Text">@NoDataMessage</MudAlert>
|
||||
}
|
||||
}
|
||||
</tbody>
|
||||
</MudSimpleTable>
|
||||
|
||||
@code {
|
||||
|
||||
/// <summary>
|
||||
/// The data to display.
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
public DataPanelModel Data { get; set; } = new ();
|
||||
|
||||
/// <summary>
|
||||
/// If true, empty values will be hidden.
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
public bool HideEmptyValues { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// If true, a message will be displayed when there is no data.
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
public bool ShowNoDataAlert { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The message to display when there is no data.
|
||||
/// </summary>
|
||||
[Parameter]
|
||||
public string NoDataMessage { get; set; } = "No data available.";
|
||||
|
||||
[Inject] private IClipboard Clipboard { get; set; } = null!;
|
||||
|
||||
private async Task OnCopyClicked(string value)
|
||||
{
|
||||
await Clipboard.CopyText(value);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user