@* Reusable name-input dialog for the /raw create + rename operations (New folder / New tag-group / New group / Rename folder-driver-device-tag-group). Inline-validates the input as a RawPath segment (RawPaths.ValidateSegment) before raising OnSubmit; a valid submit self-closes the dialog and the caller runs the create/rename service call + surfaces any server-side error/warnings. Markup mirrors the other /raw modal shells (RawStubModal). *@ @using ZB.MOM.WW.OtOpcUa.Commons.Types @if (Visible) { } @code { /// Whether the dialog is shown (supports @bind-Visible). [Parameter] public bool Visible { get; set; } /// Two-way visibility callback. [Parameter] public EventCallback VisibleChanged { get; set; } /// The dialog title (e.g. "New folder", "Rename driver"). [Parameter] public string Title { get; set; } = "Name"; /// The initial value seeded into the input on open (blank for create, current name for rename). [Parameter] public string Value { get; set; } = ""; /// Raised with the validated name when the operator confirms. The dialog self-closes after. [Parameter] public EventCallback OnSubmit { get; set; } private string _value = ""; private string? _error; private bool _open; // seed the input once per open; preserve typing across unrelated re-renders protected override void OnParametersSet() { if (!Visible) { _open = false; return; } if (_open) { return; } _open = true; _value = Value ?? ""; _error = null; } private async Task Submit() { var err = RawPaths.ValidateSegment(_value); if (err is not null) { _error = err; return; } await OnSubmit.InvokeAsync(_value); await Close(); } private async Task OnKeyDown(KeyboardEventArgs e) { if (e.Key == "Enter") { await Submit(); } } private Task Cancel() => Close(); private async Task Close() { Visible = false; _open = false; await VisibleChanged.InvokeAsync(false); } }