feat: Kh component library, record pages and profile security (M3, part 2)

Adds the building blocks every later screen uses, so modules are built from
one set of components instead of ad hoc markup:

- Form components (KhForm, KhTextBox, KhNumberBox, KhDateBox, KhSelect,
  KhCheck, KhSwitch, KhHotlink) with Italian number and date input, inline
  calculation (=10*3), field messages plus a summary that focuses the field,
  and service errors added by field name.
- Display and window components (panels, tiles, badges, chips, money, tabs
  with Alt+1..9, steps, dialog, side drawer and DrawerService).
- KhIconToolbar that keeps one line and moves less used commands into the
  "..." menu, KhDocHead, and the RecordPage/DocumentPage/MasterDataPage bases
  with standard commands, shortcuts and save/cancel/delete flow (#27, #29).
- Development-only component catalog and sample document page.
- Profile: personal data, password change that ends other sessions, TOTP
  enable/disable and recovery codes through ProfileService (#31).

Refs #27 #29 #31

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Alby96andClaude Opus 5.5 committed 2026-11-11 18:11:16 +01:00
1 parent cf6f849cc1
commit d958e7372d
57 files changed
+5249 -12

No files matched your search

+50
View File
@@ -106,3 +106,53 @@ public sealed class DialogService
pending?.TrySetResult(confirmed);
}
}
/// <summary>A side panel opened from code (SPEC §10.7 <c>DrawerService</c>).</summary>
/// <param name="Title">The title.</param>
/// <param name="Icon">The icon.</param>
/// <param name="Content">The content.</param>
/// <param name="Footer">The buttons, or <see langword="null"/>.</param>
/// <param name="Wide">A wider panel.</param>
public sealed record DrawerRequest(string Title, string? Icon, Microsoft.AspNetCore.Components.RenderFragment Content,
Microsoft.AspNetCore.Components.RenderFragment? Footer = null, bool Wide = false);
/// <summary>
/// Opens one side panel at a time from code; <c>KhDrawerHost</c> in the layout shows it. A page that owns its panel
/// can also write <c>&lt;KhDrawer Open="..."&gt;</c> directly.
/// </summary>
public sealed class DrawerService
{
private TaskCompletionSource? _closed;
/// <summary>Raised when the panel opens, closes or must be drawn again.</summary>
public event Action? Changed;
/// <summary>The panel shown, or <see langword="null"/>.</summary>
public DrawerRequest? Current { get; private set; }
/// <summary>Shows a panel, closing the previous one.</summary>
/// <param name="request">The panel.</param>
/// <returns>A task that ends when the panel is closed.</returns>
public Task ShowAsync(DrawerRequest request)
{
ArgumentNullException.ThrowIfNull(request);
_closed?.TrySetResult();
_closed = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously);
Current = request;
Changed?.Invoke();
return _closed.Task;
}
/// <summary>Closes the panel.</summary>
public void Close()
{
var closed = _closed;
_closed = null;
Current = null;
Changed?.Invoke();
closed?.TrySetResult();
}
/// <summary>Draws the panel again after its data changed.</summary>
public void Refresh() => Changed?.Invoke();
}