diff --git a/src/ZB.MOM.WW.ScadaBridge.CentralUI/Components/Shared/TemplatePickerDialog.razor b/src/ZB.MOM.WW.ScadaBridge.CentralUI/Components/Shared/TemplatePickerDialog.razor new file mode 100644 index 00000000..079bd570 --- /dev/null +++ b/src/ZB.MOM.WW.ScadaBridge.CentralUI/Components/Shared/TemplatePickerDialog.razor @@ -0,0 +1,138 @@ +@* + Body component for the Create Instance template picker, hosted by + IDialogService.ShowAsync. Wraps the shared TemplateFolderTree (the same tree + the Templates page renders) with its own search box. Templates are the only + selectable nodes — folders just toggle — and a double-click selects. Closes + with TemplatePickResult, a record so Cancel (null) is distinguishable from a + pick, the same contract MoveTemplateDialog uses. + + Selection is tracked here rather than through TreeView's SelectedKey: in + Single mode TemplateFolderTree forwards only the Checkbox-mode SelectedKeys + pair, so the row highlight has to come from this component's own NodeContent. +*@ +@using ZB.MOM.WW.ScadaBridge.Commons.Entities.Templates +@using ZB.MOM.WW.ScadaBridge.CentralUI.Services + +
+
+ + @if (!string.IsNullOrEmpty(_search)) + { + + } +
+ + +
+ +
+ + + + + + @node.Name + @if (node.Kind == TemplateTreeNodeKind.Folder && node.Children.Count > 0) + { + + @node.Children.Count + + } + + No templates match. + +
+ + + +@code { + /// Supplied by IDialogService.ShowAsync; closes/cancels the modal. + [Parameter] public DialogContext Context { get; set; } = default!; + + /// Folder catalogue backing the tree. + [Parameter] public IReadOnlyList Folders { get; set; } = Array.Empty(); + + /// Template catalogue backing the tree. + [Parameter] public IReadOnlyList