@* #520 stage 7 — recursive, single-select renderer for the ACL scope picker.
Deliberately a separate component from RawTree rather than a third mode on it. RawTree already carries
the /raw editing tree AND the equipment reference picker; a third mode would put the scope picker's
bugs on the same page as device authoring, and this repo has no bUnit to catch that. This renders the
unified AclScopeNode, so ONE component covers both the raw and the UNS hierarchy. *@
@using ZB.MOM.WW.OtOpcUa.AdminUI.Acls
@foreach (var node in Nodes)
{
@RenderNode(node, 0)
}
@code {
/// The rows to render at this level.
[Parameter, EditorRequired] public IReadOnlyList Nodes { get; set; } = default!;
/// The of the currently-selected row, if any.
[Parameter] public string? SelectedKey { get; set; }
/// Raised when a selectable row is chosen. Single-select: a grant has exactly one scope.
[Parameter] public EventCallback OnSelect { get; set; }
///
/// Loads one lazy level (the raw side). Wired by the host to IAclScopeService.LoadChildrenAsync;
/// when absent, every node is treated as already materialised.
///
[Parameter] public Func>>? LoadChildren { get; set; }
private RenderFragment RenderNode(AclScopeNode node, int depth) => __builder =>
{
var indent = $"padding-left:{depth * 18}px";
var hasExpander = node.HasLazyChildren || node.Children.Count > 0;
var selected = node.Selectable && node.Key == SelectedKey;
@if (hasExpander)
{
}
else
{
}
@if (node.Selectable)
{
}
else
{
@* Label only — an enterprise heading, or a level with no ACL scope kind behind it. *@
@node.Icon@node.DisplayName
}
@if (node.Expanded && node.Loading)
{
Loading…
}
else if (node.Expanded && node.Error is not null)
{