37 lines
1.7 KiB
Plaintext
37 lines
1.7 KiB
Plaintext
@*
|
|
T33b: body component for the "Move template" dialog hosted by
|
|
IDialogService.ShowAsync. Renders ONLY the picker + action buttons inside the
|
|
host's .modal-body; the host owns the backdrop, header, and focus trap. Closes
|
|
with a MoveTemplateResult carrying the picked folder id (null = Root) — a result
|
|
record so Close(null) for the Root choice stays distinguishable from a Cancel.
|
|
*@
|
|
<select class="form-select form-select-sm" @bind="_targetFolderId">
|
|
@foreach (var opt in FolderOptions)
|
|
{
|
|
<option value="@opt.Id">@opt.Label</option>
|
|
}
|
|
</select>
|
|
|
|
<div class="modal-footer px-0 pb-0 mt-3">
|
|
<button class="btn btn-outline-secondary btn-sm" @onclick="() => Context.Cancel()">Cancel</button>
|
|
<button class="btn btn-primary btn-sm" @onclick="Submit">Move</button>
|
|
</div>
|
|
|
|
@code {
|
|
/// <summary>Host-supplied context used to close (with the picked folder id) or cancel.</summary>
|
|
[Parameter] public DialogContext<MoveTemplateResult> Context { get; set; } = default!;
|
|
[Parameter] public IEnumerable<(int? Id, string Label)> FolderOptions { get; set; } = Array.Empty<(int?, string)>();
|
|
|
|
private int? _targetFolderId;
|
|
|
|
private void Submit() => Context.Close(new MoveTemplateResult(_targetFolderId));
|
|
|
|
/// <summary>
|
|
/// Result of the move-template picker. A reference type so a non-null close is
|
|
/// distinguishable from a cancel even when the picked folder is null (Root):
|
|
/// ShowAsync resolves to this record on Move and to <c>null</c> on Cancel.
|
|
/// </summary>
|
|
/// <param name="NewFolderId">The chosen destination folder id, or <c>null</c> for Root.</param>
|
|
public sealed record MoveTemplateResult(int? NewFolderId);
|
|
}
|