Skip to content

Commit 2915ad1

Browse files
Return ComponentElement from factory methods
DataGrid<T>, PropertyGrid, and VirtualList factory methods now return ComponentElement instead of the base Element type. These factories wrap typed element records in ComponentElement via Component<T,P>(), so ComponentElement is the accurate return type. Fixes #263 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 2d9b743 commit 2915ad1

5 files changed

Lines changed: 12 additions & 12 deletions

File tree

plugins/reactor/skills/reactor-dsl/references/reactor.api.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ Component<T, TProps>(TProps props) → ComponentElement
4141
Component<T>() → ComponentElement
4242
ContentDialog(string title, Element content, string primaryButtonText = "OK") → ContentDialogElement
4343
ContentFlyout(Element content, FlyoutPlacementMode placement = FlyoutPlacementMode.Auto) → ContentFlyoutElement
44-
DataGrid<T>(IDataSource<T> source, IReadOnlyList<FieldDescriptor> columns, TypeRegistry registry = null, SelectionMode selectionMode = SelectionMode.None, Action<IReadOnlySet<RowKey>> onSelectionChanged = null, Func<RowKey, T, Task> onRowChanged = null, double? rowHeight = 40, bool editable = false, EditMode editMode = EditMode.Cell, Func<CellContext<T>, Element> cellTemplate = null, Func<RowContext<T>, Element> rowTemplate = null, Func<HeaderContext, Element> headerTemplate = null, Element loadingTemplate = null, Element emptyTemplate = null, bool showSearch = false, Func<T, RowKey, Element> rowDetailTemplate = null, Func<FieldDescriptor, double, Element> placeholderCellTemplate = null) → Element
45-
DataGrid<T>(IDataSource<T> source, TypeRegistry registry, Func<FieldDescriptor, FieldDescriptor> columnOverrides = null, SelectionMode selectionMode = SelectionMode.None, Action<IReadOnlySet<RowKey>> onSelectionChanged = null, Func<RowKey, T, Task> onRowChanged = null, double? rowHeight = 40, bool editable = false, EditMode editMode = EditMode.Cell, Element loadingTemplate = null, Element emptyTemplate = null) → Element
44+
DataGrid<T>(IDataSource<T> source, IReadOnlyList<FieldDescriptor> columns, TypeRegistry registry = null, SelectionMode selectionMode = SelectionMode.None, Action<IReadOnlySet<RowKey>> onSelectionChanged = null, Func<RowKey, T, Task> onRowChanged = null, double? rowHeight = 40, bool editable = false, EditMode editMode = EditMode.Cell, Func<CellContext<T>, Element> cellTemplate = null, Func<RowContext<T>, Element> rowTemplate = null, Func<HeaderContext, Element> headerTemplate = null, Element loadingTemplate = null, Element emptyTemplate = null, bool showSearch = false, Func<T, RowKey, Element> rowDetailTemplate = null, Func<FieldDescriptor, double, Element> placeholderCellTemplate = null) → ComponentElement
45+
DataGrid<T>(IDataSource<T> source, TypeRegistry registry, Func<FieldDescriptor, FieldDescriptor> columnOverrides = null, SelectionMode selectionMode = SelectionMode.None, Action<IReadOnlySet<RowKey>> onSelectionChanged = null, Func<RowKey, T, Task> onRowChanged = null, double? rowHeight = 40, bool editable = false, EditMode editMode = EditMode.Cell, Element loadingTemplate = null, Element emptyTemplate = null) → ComponentElement
4646
DatePicker(DateTimeOffset date, Action<DateTimeOffset> onDateChanged = null) → DatePickerElement
4747
DevtoolsMenu(Func<IEnumerable<MenuFlyoutItemBase>> items = null, string glyph = "⚡", string toolTip = "Devtools", string automationId = null) → Element
4848
DropDownButton(string label, Element flyout = null) → DropDownButtonElement
@@ -122,7 +122,7 @@ Progress(double value) → ProgressElement
122122
ProgressIndeterminate() → ProgressElement
123123
ProgressRing() → ProgressRingElement
124124
ProgressRing(double value) → ProgressRingElement
125-
PropertyGrid(object target, TypeRegistry registry, Action<object> onRootChanged = null) → Element
125+
PropertyGrid(object target, TypeRegistry registry, Action<object> onRootChanged = null) → ComponentElement
126126
RadioButton(string label, bool isChecked = false, Action<bool> onChecked = null, string groupName = null) → RadioButtonElement
127127
RadioButtons(string[] items, int selectedIndex = -1, Action<int> onSelectionChanged = null) → RadioButtonsElement
128128
RadioMenuItem(string text, string groupName, bool isChecked = false, Action onClick = null, string icon = null) → RadioMenuFlyoutItemData
@@ -171,7 +171,7 @@ UniformGrid(Orientation orientation, Element[] items) → GridElement
171171
VStack(Element[] children) → StackElement
172172
VStack(double spacing, Element[] children) → StackElement
173173
Viewbox(Element child) → ViewboxElement
174-
VirtualList(int itemCount, Func<int, Element> renderItem, Func<int, string> getItemKey = null, double? itemHeight = null, double estimatedItemHeight = 40, double spacing = 0, Action<VirtualListRef> ref = null, Action<int, int> onVisibleRangeChanged = null) → Element
174+
VirtualList(int itemCount, Func<int, Element> renderItem, Func<int, string> getItemKey = null, double? itemHeight = null, double estimatedItemHeight = 40, double spacing = 0, Action<VirtualListRef> ref = null, Action<int, int> onVisibleRangeChanged = null) → ComponentElement
175175
WebView2(Uri source = null) → WebView2Element
176176
When(bool condition, Func<Element> then) → Element
177177
WrapGrid(Element[] children) → WrapGridElement

skills/reactor.api.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ Component<T, TProps>(TProps props) → ComponentElement
4141
Component<T>() → ComponentElement
4242
ContentDialog(string title, Element content, string primaryButtonText = "OK") → ContentDialogElement
4343
ContentFlyout(Element content, FlyoutPlacementMode placement = FlyoutPlacementMode.Auto) → ContentFlyoutElement
44-
DataGrid<T>(IDataSource<T> source, IReadOnlyList<FieldDescriptor> columns, TypeRegistry registry = null, SelectionMode selectionMode = SelectionMode.None, Action<IReadOnlySet<RowKey>> onSelectionChanged = null, Func<RowKey, T, Task> onRowChanged = null, double? rowHeight = 40, bool editable = false, EditMode editMode = EditMode.Cell, Func<CellContext<T>, Element> cellTemplate = null, Func<RowContext<T>, Element> rowTemplate = null, Func<HeaderContext, Element> headerTemplate = null, Element loadingTemplate = null, Element emptyTemplate = null, bool showSearch = false, Func<T, RowKey, Element> rowDetailTemplate = null, Func<FieldDescriptor, double, Element> placeholderCellTemplate = null) → Element
45-
DataGrid<T>(IDataSource<T> source, TypeRegistry registry, Func<FieldDescriptor, FieldDescriptor> columnOverrides = null, SelectionMode selectionMode = SelectionMode.None, Action<IReadOnlySet<RowKey>> onSelectionChanged = null, Func<RowKey, T, Task> onRowChanged = null, double? rowHeight = 40, bool editable = false, EditMode editMode = EditMode.Cell, Element loadingTemplate = null, Element emptyTemplate = null) → Element
44+
DataGrid<T>(IDataSource<T> source, IReadOnlyList<FieldDescriptor> columns, TypeRegistry registry = null, SelectionMode selectionMode = SelectionMode.None, Action<IReadOnlySet<RowKey>> onSelectionChanged = null, Func<RowKey, T, Task> onRowChanged = null, double? rowHeight = 40, bool editable = false, EditMode editMode = EditMode.Cell, Func<CellContext<T>, Element> cellTemplate = null, Func<RowContext<T>, Element> rowTemplate = null, Func<HeaderContext, Element> headerTemplate = null, Element loadingTemplate = null, Element emptyTemplate = null, bool showSearch = false, Func<T, RowKey, Element> rowDetailTemplate = null, Func<FieldDescriptor, double, Element> placeholderCellTemplate = null) → ComponentElement
45+
DataGrid<T>(IDataSource<T> source, TypeRegistry registry, Func<FieldDescriptor, FieldDescriptor> columnOverrides = null, SelectionMode selectionMode = SelectionMode.None, Action<IReadOnlySet<RowKey>> onSelectionChanged = null, Func<RowKey, T, Task> onRowChanged = null, double? rowHeight = 40, bool editable = false, EditMode editMode = EditMode.Cell, Element loadingTemplate = null, Element emptyTemplate = null) → ComponentElement
4646
DatePicker(DateTimeOffset date, Action<DateTimeOffset> onDateChanged = null) → DatePickerElement
4747
DevtoolsMenu(Func<IEnumerable<MenuFlyoutItemBase>> items = null, string glyph = "⚡", string toolTip = "Devtools", string automationId = null) → Element
4848
DropDownButton(string label, Element flyout = null) → DropDownButtonElement
@@ -122,7 +122,7 @@ Progress(double value) → ProgressElement
122122
ProgressIndeterminate() → ProgressElement
123123
ProgressRing() → ProgressRingElement
124124
ProgressRing(double value) → ProgressRingElement
125-
PropertyGrid(object target, TypeRegistry registry, Action<object> onRootChanged = null) → Element
125+
PropertyGrid(object target, TypeRegistry registry, Action<object> onRootChanged = null) → ComponentElement
126126
RadioButton(string label, bool isChecked = false, Action<bool> onChecked = null, string groupName = null) → RadioButtonElement
127127
RadioButtons(string[] items, int selectedIndex = -1, Action<int> onSelectionChanged = null) → RadioButtonsElement
128128
RadioMenuItem(string text, string groupName, bool isChecked = false, Action onClick = null, string icon = null) → RadioMenuFlyoutItemData
@@ -171,7 +171,7 @@ UniformGrid(Orientation orientation, Element[] items) → GridElement
171171
VStack(Element[] children) → StackElement
172172
VStack(double spacing, Element[] children) → StackElement
173173
Viewbox(Element child) → ViewboxElement
174-
VirtualList(int itemCount, Func<int, Element> renderItem, Func<int, string> getItemKey = null, double? itemHeight = null, double estimatedItemHeight = 40, double spacing = 0, Action<VirtualListRef> ref = null, Action<int, int> onVisibleRangeChanged = null) → Element
174+
VirtualList(int itemCount, Func<int, Element> renderItem, Func<int, string> getItemKey = null, double? itemHeight = null, double estimatedItemHeight = 40, double spacing = 0, Action<VirtualListRef> ref = null, Action<int, int> onVisibleRangeChanged = null) → ComponentElement
175175
WebView2(Uri source = null) → WebView2Element
176176
When(bool condition, Func<Element> then) → Element
177177
WrapGrid(Element[] children) → WrapGridElement

src/Reactor/Controls/DataGrid/DataGridFactories.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ public static partial class Factories
99
/// <summary>
1010
/// Creates a DataGrid with explicit column definitions.
1111
/// </summary>
12-
public static Element DataGrid<T>(
12+
public static ComponentElement DataGrid<T>(
1313
IDataSource<T> source,
1414
IReadOnlyList<FieldDescriptor> columns,
1515
TypeRegistry? registry = null,
@@ -56,7 +56,7 @@ public static Element DataGrid<T>(
5656
/// <summary>
5757
/// Creates a DataGrid with auto-generated columns from TypeRegistry + reflection.
5858
/// </summary>
59-
public static Element DataGrid<T>(
59+
public static ComponentElement DataGrid<T>(
6060
IDataSource<T> source,
6161
TypeRegistry registry,
6262
Func<FieldDescriptor, FieldDescriptor>? columnOverrides = null,

src/Reactor/Controls/PropertyGrid/PropertyGridFactories.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ public static partial class Factories
1010
/// Keyed by target type so switching between different target types creates
1111
/// a fresh component (avoiding broken reconciliation of different structures).
1212
/// </summary>
13-
public static Element PropertyGrid(
13+
public static ComponentElement PropertyGrid(
1414
object target,
1515
TypeRegistry registry,
1616
Action<object>? onRootChanged = null)

src/Reactor/Controls/Virtualization/VirtualListFactories.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ public static partial class Factories
99
/// Creates a VirtualList element — a count-based virtualized list.
1010
/// Items are rendered on demand via the renderItem callback.
1111
/// </summary>
12-
public static Element VirtualList(
12+
public static ComponentElement VirtualList(
1313
int itemCount,
1414
Func<int, Element> renderItem,
1515
Func<int, string>? getItemKey = null,

0 commit comments

Comments
 (0)