feat(m9/T22): template tree search box (wire TemplateFolderTree.Filter)

This commit is contained in:
Joseph Doherty
2026-06-18 10:35:35 -04:00
parent efcdd18794
commit f618ac0322
2 changed files with 70 additions and 1 deletions
@@ -79,12 +79,28 @@
</div>
</div>
<div style="max-height: calc(100vh - 160px); overflow-y: auto; padding: 4px;">
<div class="mb-3" style="max-width: 320px;">
<div class="input-group input-group-sm">
<input type="text" class="form-control form-control-sm"
placeholder="Search templates..."
value="@_searchText"
@oninput="e => _searchText = e.Value?.ToString() ?? string.Empty" />
@if (!string.IsNullOrEmpty(_searchText))
{
<button class="btn btn-outline-secondary" type="button"
title="Clear search"
@onclick="() => _searchText = string.Empty">✕</button>
}
</div>
</div>
<div style="max-height: calc(100vh - 200px); overflow-y: auto; padding: 4px;">
<TemplateFolderTree @ref="_tree"
Folders="_folders"
Templates="_templates"
SelectionMode="TreeViewSelectionMode.Single"
ExtraTemplateChildren="BuildCompositionLeavesFor"
Filter="@_searchText"
StorageKey="templates-tree">
<NodeContent Context="node">
@RenderNodeLabel(node)
@@ -109,6 +125,10 @@
private List<Template> _templates = new();
private List<TemplateFolder> _folders = new();
// Search text bound to the filter input; passed as Filter to TemplateFolderTree
// which handles substring matching and ancestor auto-expand internally.
private string _searchText = string.Empty;
private bool _loading = true;
private string? _errorMessage;