Skip to content

Commit 16ae8b9

Browse files
committed
Update decor function signatures and package versions
Changed LeftDecor and RightDecor in ConsumerDefinition to accept two parameters for improved flexibility. Updated NLog and Svg.Skia package versions. Adjusted usages in MainViewModel to match new function signatures.
1 parent 96449e9 commit 16ae8b9

4 files changed

Lines changed: 26 additions & 10 deletions

File tree

src/Demo.AvaloniaApplication/ViewModels/MainViewModel.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ var child in Enumerable
199199
switch (x)
200200
{
201201
case 3:
202-
cdef.RightDecor = o =>
202+
cdef.RightDecor = (_, o) =>
203203
o switch
204204
{
205205
int i => i % 2 == 0
@@ -214,11 +214,11 @@ var child in Enumerable
214214
};
215215
break;
216216
case 5:
217-
cdef.LeftDecor = _ => "Resources/comment.svg";
217+
cdef.LeftDecor = (_, o) => "Resources/comment.svg";
218218
break;
219219
case 6:
220-
cdef.RightDecor = _ => "Resources/comment.svg";
221-
cdef.LeftDecor = _ => "Resources/edit.svg";
220+
cdef.RightDecor = (_, o) => "Resources/comment.svg";
221+
cdef.LeftDecor = (_, o) => "Resources/edit.svg";
222222
break;
223223
}
224224

src/Demo/Demo.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
<ItemGroup>
1111
<PackageReference Include="Bogus" Version="35.6.3" />
12-
<PackageReference Include="NLog" Version="6.0.1" />
12+
<PackageReference Include="NLog" Version="6.0.2" />
1313
<PackageReference Include="Splat.NLog" Version="15.4.1" />
1414
</ItemGroup>
1515

src/HierarchyGrid.Definitions/ConsumerDefinition.cs

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,20 @@ public ConsumerDefinition(Guid? id = null)
2828
public Func<object, Qualification>? Qualify { get; set; } = _ => Qualification.Normal;
2929
public Func<object, (ThemeColor, ThemeColor)>? Colorize { get; set; }
3030
public Func<object, object, string>? TooltipCreator { get; set; }
31-
public Func<object, string>? LeftDecor { get; set; }
32-
public Func<object, string>? RightDecor { get; set; }
31+
32+
/// <summary>
33+
/// Function that provides custom left-side decorations for display in the UI.
34+
/// Takes two input parameters: the raw input object and its transformed data,
35+
/// returning a string that represents the left-side decoration content.
36+
/// </summary>
37+
public Func<object, object, string>? LeftDecor { get; set; }
38+
39+
/// <summary>
40+
/// Function that provides custom right-side decorations for display in the UI.
41+
/// Takes two input parameters: the raw input object and its transformed data,
42+
/// returning a string that represents the right-side decoration content.
43+
/// </summary>
44+
public Func<object, object, string>? RightDecor { get; set; }
3345

3446
/// <summary>
3547
/// Func that will be called from editing textbox, input being string from textbox and bool being the success state of the update.
@@ -87,8 +99,12 @@ public ResultSet Process(InputSet inputSet)
8799
.ToArray();
88100
}
89101

90-
Option<string> leftDecor = LeftDecor is not null ? LeftDecor(data) : Option<string>.None;
91-
Option<string> rightDecor = RightDecor is not null ? RightDecor(data) : Option<string>.None;
102+
Option<string> leftDecor = LeftDecor is not null
103+
? LeftDecor(inputSet.Input, data)
104+
: Option<string>.None;
105+
Option<string> rightDecor = RightDecor is not null
106+
? RightDecor(inputSet.Input, data)
107+
: Option<string>.None;
92108

93109
var resultSet = new ResultSet
94110
{

src/HierarchyGrid.Skia/HierarchyGrid.Skia.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<PackageReference Include="SkiaSharp.NativeAssets.Linux" Version="3.119.0" />
2222
<PackageReference Include="SkiaSharp.NativeAssets.macOS" Version="3.119.0" />
2323
<PackageReference Include="SkiaSharp.NativeAssets.Win32" Version="3.119.0" />
24-
<PackageReference Include="Svg.Skia" Version="3.0.3" />
24+
<PackageReference Include="Svg.Skia" Version="3.0.4" />
2525
<PackageReference Include="System.Text.Json" Version="9.0.7" />
2626
<PackageReference Include="Topten.RichTextKit" Version="0.4.167" />
2727
</ItemGroup>

0 commit comments

Comments
 (0)