Skip to content

Commit 5b37118

Browse files
sundaramramaswamyCopilotCopilot
authored
Return ComponentElement from factory methods (#300)
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> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
1 parent 0dba55c commit 5b37118

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
@@ -45,8 +45,8 @@ Component<T, TProps>(TProps props) → ComponentElement
4545
Component<T>() → ComponentElement
4646
ContentDialog(string title, Element content, string primaryButtonText = "OK") → ContentDialogElement
4747
ContentFlyout(Element content, FlyoutPlacementMode placement = FlyoutPlacementMode.Auto) → ContentFlyoutElement
48-
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
49-
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
48+
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
49+
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
5050
DatePicker(DateTimeOffset date, Action<DateTimeOffset> onDateChanged = null) → DatePickerElement
5151
DevtoolsMenu(Func<IEnumerable<MenuFlyoutItemBase>> items = null, string glyph = "⚡", string toolTip = "Devtools", string automationId = null) → Element
5252
DropDownButton(string label, Element flyout = null) → DropDownButtonElement
@@ -131,7 +131,7 @@ Progress(double value) → ProgressElement
131131
ProgressIndeterminate() → ProgressElement
132132
ProgressRing() → ProgressRingElement
133133
ProgressRing(double value) → ProgressRingElement
134-
PropertyGrid(object target, TypeRegistry registry, Action<object> onRootChanged = null) → Element
134+
PropertyGrid(object target, TypeRegistry registry, Action<object> onRootChanged = null) → ComponentElement
135135
RadioButton(string label, bool isChecked = false, Action<bool> onIsCheckedChanged = null, string groupName = null) → RadioButtonElement
136136
RadioButtons(string[] items, int selectedIndex = -1, Action<int> onSelectedIndexChanged = null) → RadioButtonsElement
137137
RadioMenuItem(string text, string groupName, bool isChecked = false, Action onClick = null, string icon = null) → RadioMenuFlyoutItemData
@@ -183,7 +183,7 @@ UniformGrid(Orientation orientation, Element[] items) → GridElement
183183
VStack(Element[] children) → StackElement
184184
VStack(double spacing, Element[] children) → StackElement
185185
Viewbox(Element child) → ViewboxElement
186-
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
186+
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
187187
WebView2(Uri source = null) → WebView2Element
188188
When(bool condition, Func<Element> then) → Element
189189
WrapGrid(Element[] children) → WrapGridElement

skills/reactor.api.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ Component<T, TProps>(TProps props) → ComponentElement
4545
Component<T>() → ComponentElement
4646
ContentDialog(string title, Element content, string primaryButtonText = "OK") → ContentDialogElement
4747
ContentFlyout(Element content, FlyoutPlacementMode placement = FlyoutPlacementMode.Auto) → ContentFlyoutElement
48-
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
49-
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
48+
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
49+
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
5050
DatePicker(DateTimeOffset date, Action<DateTimeOffset> onDateChanged = null) → DatePickerElement
5151
DevtoolsMenu(Func<IEnumerable<MenuFlyoutItemBase>> items = null, string glyph = "⚡", string toolTip = "Devtools", string automationId = null) → Element
5252
DropDownButton(string label, Element flyout = null) → DropDownButtonElement
@@ -131,7 +131,7 @@ Progress(double value) → ProgressElement
131131
ProgressIndeterminate() → ProgressElement
132132
ProgressRing() → ProgressRingElement
133133
ProgressRing(double value) → ProgressRingElement
134-
PropertyGrid(object target, TypeRegistry registry, Action<object> onRootChanged = null) → Element
134+
PropertyGrid(object target, TypeRegistry registry, Action<object> onRootChanged = null) → ComponentElement
135135
RadioButton(string label, bool isChecked = false, Action<bool> onIsCheckedChanged = null, string groupName = null) → RadioButtonElement
136136
RadioButtons(string[] items, int selectedIndex = -1, Action<int> onSelectedIndexChanged = null) → RadioButtonsElement
137137
RadioMenuItem(string text, string groupName, bool isChecked = false, Action onClick = null, string icon = null) → RadioMenuFlyoutItemData
@@ -183,7 +183,7 @@ UniformGrid(Orientation orientation, Element[] items) → GridElement
183183
VStack(Element[] children) → StackElement
184184
VStack(double spacing, Element[] children) → StackElement
185185
Viewbox(Element child) → ViewboxElement
186-
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
186+
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
187187
WebView2(Uri source = null) → WebView2Element
188188
When(bool condition, Func<Element> then) → Element
189189
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)