Skip to content

Commit b251d69

Browse files
committed
3.0.32 - Fixes #323 + added overload on function binding that allows specifying the component to attach
1 parent 71ef3f7 commit b251d69

File tree

99 files changed

+1661
-2316
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

99 files changed

+1661
-2316
lines changed

.github/workflows/build-deploy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
Solution_Name: ./src/MauiReactor.Build.sln
1717
Test_Project: ./samples/UnitTests/UnitTests.csproj
1818
TemplatePack_Name: ./src/MauiReactor.TemplatePack/MauiReactor.TemplatePack.csproj
19-
Version: 3.0.31
19+
Version: 3.0.32
2020

2121
steps:
2222
- name: Checkout

src/MauiReactor.Scaffold/TypeGenerator.cs

Lines changed: 276 additions & 304 deletions
Large diffs are not rendered by default.

src/MauiReactor.Scaffold/TypeGenerator.tt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -311,13 +311,12 @@ public static partial class <#= TypeName() #>Extensions
311311
}
312312
<# } #>
313313

314-
public static T <#= property.Name #><T>(this T <#= TypeName().ToLocalVariableName() #>, Func<<#= property.PropertyType.FullName.ToResevedWordFullTypeName() #>> <#= property.Name.CamelCase() #>Func) where T : <#= InterfaceName() #>
314+
public static T <#= property.Name #><T>(this T <#= TypeName().ToLocalVariableName() #>, Func<<#= property.PropertyType.FullName.ToResevedWordFullTypeName() #>> <#= property.Name.CamelCase() #>Func, IComponentWithState? componentWithState = null) where T : <#= InterfaceName() #>
315315
{
316-
//<#= TypeName().ToLocalVariableName() #>.<#= property.Name #> = new PropertyValue<<#= property.PropertyType.FullName.ToResevedWordFullTypeName() #>>(<#= property.Name.CamelCase() #>Func);
317316
<# if (IsGenericType()) { #>
318-
<#= TypeName().ToLocalVariableName() #>.<#= property.Name #> = new PropertyValue<<#= property.PropertyType.FullName.ToResevedWordFullTypeName() #>>(<#= property.Name.CamelCase() #>Func);
317+
<#= TypeName().ToLocalVariableName() #>.<#= property.Name #> = new PropertyValue<<#= property.PropertyType.FullName.ToResevedWordFullTypeName() #>>(<#= property.Name.CamelCase() #>Func, componentWithState);
319318
<# } else { #>
320-
<#= TypeName().ToLocalVariableName() #>.SetProperty(<#= FullTypeName() #>.<#= property.Name #>Property, new PropertyValue<<#= property.PropertyType.FullName.ToResevedWordFullTypeName() #>>(<#= property.Name.CamelCase() #>Func));
319+
<#= TypeName().ToLocalVariableName() #>.SetProperty(<#= FullTypeName() #>.<#= property.Name #>Property, new PropertyValue<<#= property.PropertyType.FullName.ToResevedWordFullTypeName() #>>(<#= property.Name.CamelCase() #>Func, componentWithState));
321320
<# } #>
322321
return <#= TypeName().ToLocalVariableName() #>;
323322
}

src/MauiReactor.ScaffoldGenerator/ScaffoldTypeGenerator.cs

Lines changed: 526 additions & 729 deletions
Large diffs are not rendered by default.

src/MauiReactor.ScaffoldGenerator/ScaffoldTypeGenerator.tt

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,6 @@ namespace <#= Namespace #>
492492
<# } else if (property.Type.Equals(TypeofFloat, SymbolEqualityComparer.Default)) { #>
493493
public static T <#= property.Name #><T>(this T <#= TypeName.ToLocalVariableName() #>, <#= property.Type.GetFullyQualifiedName().ToReservedWordFullTypeName() #> <#= property.Name.CamelCase() #>, RxFloatAnimation? customAnimation = null) where T : <#= InterfaceName #>
494494
{
495-
//<#= TypeName.ToLocalVariableName() #>.<#= property.Name #> = <#= property.Name.CamelCase() #>;
496495
<# if (IsGenericType) { #>
497496
<#= TypeName.ToLocalVariableName() #>.<#= property.Name #> = <#= property.Name.CamelCase() #>;
498497
<# } else { #>
@@ -504,7 +503,6 @@ namespace <#= Namespace #>
504503
<# } else if (property.Type.Equals(TypeofRect, SymbolEqualityComparer.Default)) { #>
505504
public static T <#= property.Name #><T>(this T <#= TypeName.ToLocalVariableName() #>, <#= property.Type.GetFullyQualifiedName().ToReservedWordFullTypeName() #> <#= property.Name.CamelCase() #>, RxRectAnimation? customAnimation = null) where T : <#= InterfaceName #>
506505
{
507-
//<#= TypeName.ToLocalVariableName() #>.<#= property.Name #> = <#= property.Name.CamelCase() #>;
508506
<# if (IsGenericType) { #>
509507
<#= TypeName.ToLocalVariableName() #>.<#= property.Name #> = <#= property.Name.CamelCase() #>;
510508
<# } else { #>
@@ -516,7 +514,6 @@ namespace <#= Namespace #>
516514
<# } else if (property.Type.Equals(TypeofPoint, SymbolEqualityComparer.Default)) { #>
517515
public static T <#= property.Name #><T>(this T <#= TypeName.ToLocalVariableName() #>, <#= property.Type.GetFullyQualifiedName().ToReservedWordFullTypeName() #> <#= property.Name.CamelCase() #>, RxPointAnimation? customAnimation = null) where T : <#= InterfaceName #>
518516
{
519-
//<#= TypeName.ToLocalVariableName() #>.<#= property.Name #> = <#= property.Name.CamelCase() #>;
520517
<# if (IsGenericType) { #>
521518
<#= TypeName.ToLocalVariableName() #>.<#= property.Name #> = <#= property.Name.CamelCase() #>;
522519
<# } else { #>
@@ -528,7 +525,6 @@ namespace <#= Namespace #>
528525
<# } else if (property.Type.Equals(TypeofPointF, SymbolEqualityComparer.Default)) { #>
529526
public static T <#= property.Name #><T>(this T <#= TypeName.ToLocalVariableName() #>, <#= property.Type.GetFullyQualifiedName().ToReservedWordFullTypeName() #> <#= property.Name.CamelCase() #>, RxPointFAnimation? customAnimation = null) where T : <#= InterfaceName #>
530527
{
531-
//<#= TypeName.ToLocalVariableName() #>.<#= property.Name #> = <#= property.Name.CamelCase() #>;
532528
<# if (IsGenericType) { #>
533529
<#= TypeName.ToLocalVariableName() #>.<#= property.Name #> = <#= property.Name.CamelCase() #>;
534530
<# } else { #>
@@ -540,7 +536,6 @@ namespace <#= Namespace #>
540536
<# } else if (property.Type.Equals(TypeofThickness, SymbolEqualityComparer.Default)) { #>
541537
public static T <#= property.Name #><T>(this T <#= TypeName.ToLocalVariableName() #>, <#= property.Type.GetFullyQualifiedName().ToReservedWordFullTypeName() #> <#= property.Name.CamelCase() #>, RxThicknessAnimation? customAnimation = null) where T : <#= InterfaceName #>
542538
{
543-
//<#= TypeName.ToLocalVariableName() #>.<#= property.Name #> = <#= property.Name.CamelCase() #>;
544539
<# if (IsGenericType) { #>
545540
<#= TypeName.ToLocalVariableName() #>.<#= property.Name #> = <#= property.Name.CamelCase() #>;
546541
<# } else { #>
@@ -552,7 +547,6 @@ namespace <#= Namespace #>
552547
<# } else if (property.Type.Equals(TypeofThicknessF, SymbolEqualityComparer.Default)) { #>
553548
public static T <#= property.Name #><T>(this T <#= TypeName.ToLocalVariableName() #>, <#= property.Type.GetFullyQualifiedName().ToReservedWordFullTypeName() #> <#= property.Name.CamelCase() #>, RxThicknessFAnimation? customAnimation = null) where T : <#= InterfaceName #>
554549
{
555-
//<#= TypeName.ToLocalVariableName() #>.<#= property.Name #> = <#= property.Name.CamelCase() #>;
556550
<# if (IsGenericType) { #>
557551
<#= TypeName.ToLocalVariableName() #>.<#= property.Name #> = <#= property.Name.CamelCase() #>;
558552
<# } else { #>
@@ -564,7 +558,6 @@ namespace <#= Namespace #>
564558
<# } else if (property.Type.Equals(TypeofCornerRadiusF, SymbolEqualityComparer.Default)) { #>
565559
public static T <#= property.Name #><T>(this T <#= TypeName.ToLocalVariableName() #>, <#= property.Type.GetFullyQualifiedName().ToReservedWordFullTypeName() #> <#= property.Name.CamelCase() #>, RxCornerRadiusFAnimation? customAnimation = null) where T : <#= InterfaceName #>
566560
{
567-
//<#= TypeName.ToLocalVariableName() #>.<#= property.Name #> = <#= property.Name.CamelCase() #>;
568561
<# if (IsGenericType) { #>
569562
<#= TypeName.ToLocalVariableName() #>.<#= property.Name #> = <#= property.Name.CamelCase() #>;
570563
<# } else { #>
@@ -576,7 +569,6 @@ namespace <#= Namespace #>
576569
<# } else if (property.Type.Equals(TypeofCornerRadius, SymbolEqualityComparer.Default)) { #>
577570
public static T <#= property.Name #><T>(this T <#= TypeName.ToLocalVariableName() #>, <#= property.Type.GetFullyQualifiedName().ToReservedWordFullTypeName() #> <#= property.Name.CamelCase() #>, RxCornerRadiusAnimation? customAnimation = null) where T : <#= InterfaceName #>
578571
{
579-
//<#= TypeName.ToLocalVariableName() #>.<#= property.Name #> = <#= property.Name.CamelCase() #>;
580572
<# if (IsGenericType) { #>
581573
<#= TypeName.ToLocalVariableName() #>.<#= property.Name #> = <#= property.Name.CamelCase() #>;
582574
<# } else { #>
@@ -588,7 +580,6 @@ namespace <#= Namespace #>
588580
<# } else { #>
589581
public static T <#= property.Name #><T>(this T <#= TypeName.ToLocalVariableName() #>, <#= property.Type.GetFullyQualifiedName().ToReservedWordFullTypeName() #> <#= property.Name.CamelCase() #>) where T : <#= InterfaceName #>
590582
{
591-
//<#= TypeName.ToLocalVariableName() #>.<#= property.Name #> = <#= property.Name.CamelCase() #>;
592583
<# if (IsGenericType) { #>
593584
<#= TypeName.ToLocalVariableName() #>.<#= property.Name #> = <#= property.Name.CamelCase() #>;
594585
<# } else { #>
@@ -598,19 +589,18 @@ namespace <#= Namespace #>
598589
}
599590
<# } #>
600591

601-
public static T <#= property.Name #><T>(this T <#= TypeName.ToLocalVariableName() #>, Func<<#= property.Type.GetFullyQualifiedName().ToReservedWordFullTypeName() #>> <#= property.Name.CamelCase() #>Func) where T : <#= InterfaceName #>
592+
public static T <#= property.Name #><T>(this T <#= TypeName.ToLocalVariableName() #>, Func<<#= property.Type.GetFullyQualifiedName().ToReservedWordFullTypeName() #>> <#= property.Name.CamelCase() #>Func, IComponentWithState? componentWithState = null) where T : <#= InterfaceName #>
602593
{
603594
<# if (IsGenericType) { #>
604-
<#= TypeName.ToLocalVariableName() #>.<#= property.Name #> = new PropertyValue<<#= property.Type.GetFullyQualifiedName().ToReservedWordFullTypeName() #>>(<#= property.Name.CamelCase() #>Func);
595+
<#= TypeName.ToLocalVariableName() #>.<#= property.Name #> = new PropertyValue<<#= property.Type.GetFullyQualifiedName().ToReservedWordFullTypeName() #>>(<#= property.Name.CamelCase() #>Func, componentWithState);
605596
<# } else { #>
606-
<#= TypeName.ToLocalVariableName() #>.SetProperty(global::<#= FullTypeName #>.<#= property.Name #>Property, new PropertyValue<<#= property.Type.GetFullyQualifiedName().ToReservedWordFullTypeName() #>>(<#= property.Name.CamelCase() #>Func));
597+
<#= TypeName.ToLocalVariableName() #>.SetProperty(global::<#= FullTypeName #>.<#= property.Name #>Property, new PropertyValue<<#= property.Type.GetFullyQualifiedName().ToReservedWordFullTypeName() #>>(<#= property.Name.CamelCase() #>Func, componentWithState));
607598
<# } #>
608599
return <#= TypeName.ToLocalVariableName() #>;
609600
}
610601
<# if (property.Type.Name == "Thickness") { #>
611602
public static T <#= property.Name #><T>(this T <#= TypeName.ToLocalVariableName() #>, double leftRight, double topBottom, RxThicknessAnimation? customAnimation = null) where T : <#= InterfaceName #>
612603
{
613-
//<#= TypeName.ToLocalVariableName() #>.<#= property.Name #> = new Microsoft.Maui.Thickness(leftRight, topBottom);
614604
<# if (IsGenericType) { #>
615605
<#= TypeName.ToLocalVariableName() #>.<#= property.Name #> = new Microsoft.Maui.Thickness(leftRight, topBottom);
616606
<# } else { #>

src/MauiReactor/ActivityIndicator.cs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,10 @@ public static T IsRunning<T>(this T activityIndicator, bool isRunning)
6666
return activityIndicator;
6767
}
6868

69-
public static T IsRunning<T>(this T activityIndicator, Func<bool> isRunningFunc)
69+
public static T IsRunning<T>(this T activityIndicator, Func<bool> isRunningFunc, IComponentWithState? componentWithState = null)
7070
where T : IActivityIndicator
7171
{
72-
//activityIndicator.IsRunning = new PropertyValue<bool>(isRunningFunc);
73-
activityIndicator.SetProperty(Microsoft.Maui.Controls.ActivityIndicator.IsRunningProperty, new PropertyValue<bool>(isRunningFunc));
72+
activityIndicator.SetProperty(Microsoft.Maui.Controls.ActivityIndicator.IsRunningProperty, new PropertyValue<bool>(isRunningFunc, componentWithState));
7473
return activityIndicator;
7574
}
7675

@@ -82,11 +81,10 @@ public static T Color<T>(this T activityIndicator, Microsoft.Maui.Graphics.Color
8281
return activityIndicator;
8382
}
8483

85-
public static T Color<T>(this T activityIndicator, Func<Microsoft.Maui.Graphics.Color> colorFunc)
84+
public static T Color<T>(this T activityIndicator, Func<Microsoft.Maui.Graphics.Color> colorFunc, IComponentWithState? componentWithState = null)
8685
where T : IActivityIndicator
8786
{
88-
//activityIndicator.Color = new PropertyValue<Microsoft.Maui.Graphics.Color>(colorFunc);
89-
activityIndicator.SetProperty(Microsoft.Maui.Controls.ActivityIndicator.ColorProperty, new PropertyValue<Microsoft.Maui.Graphics.Color>(colorFunc));
87+
activityIndicator.SetProperty(Microsoft.Maui.Controls.ActivityIndicator.ColorProperty, new PropertyValue<Microsoft.Maui.Graphics.Color>(colorFunc, componentWithState));
9088
return activityIndicator;
9189
}
9290
}

src/MauiReactor/BaseShellItem.cs

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -140,11 +140,10 @@ public static T FlyoutIcon<T>(this T baseShellItem, Microsoft.Maui.Controls.Imag
140140
return baseShellItem;
141141
}
142142

143-
public static T FlyoutIcon<T>(this T baseShellItem, Func<Microsoft.Maui.Controls.ImageSource> flyoutIconFunc)
143+
public static T FlyoutIcon<T>(this T baseShellItem, Func<Microsoft.Maui.Controls.ImageSource> flyoutIconFunc, IComponentWithState? componentWithState = null)
144144
where T : IBaseShellItem
145145
{
146-
//baseShellItem.FlyoutIcon = new PropertyValue<Microsoft.Maui.Controls.ImageSource>(flyoutIconFunc);
147-
baseShellItem.SetProperty(Microsoft.Maui.Controls.BaseShellItem.FlyoutIconProperty, new PropertyValue<Microsoft.Maui.Controls.ImageSource>(flyoutIconFunc));
146+
baseShellItem.SetProperty(Microsoft.Maui.Controls.BaseShellItem.FlyoutIconProperty, new PropertyValue<Microsoft.Maui.Controls.ImageSource>(flyoutIconFunc, componentWithState));
148147
return baseShellItem;
149148
}
150149

@@ -216,11 +215,10 @@ public static T Icon<T>(this T baseShellItem, Microsoft.Maui.Controls.ImageSourc
216215
return baseShellItem;
217216
}
218217

219-
public static T Icon<T>(this T baseShellItem, Func<Microsoft.Maui.Controls.ImageSource> iconFunc)
218+
public static T Icon<T>(this T baseShellItem, Func<Microsoft.Maui.Controls.ImageSource> iconFunc, IComponentWithState? componentWithState = null)
220219
where T : IBaseShellItem
221220
{
222-
//baseShellItem.Icon = new PropertyValue<Microsoft.Maui.Controls.ImageSource>(iconFunc);
223-
baseShellItem.SetProperty(Microsoft.Maui.Controls.BaseShellItem.IconProperty, new PropertyValue<Microsoft.Maui.Controls.ImageSource>(iconFunc));
221+
baseShellItem.SetProperty(Microsoft.Maui.Controls.BaseShellItem.IconProperty, new PropertyValue<Microsoft.Maui.Controls.ImageSource>(iconFunc, componentWithState));
224222
return baseShellItem;
225223
}
226224

@@ -292,11 +290,10 @@ public static T IsEnabled<T>(this T baseShellItem, bool isEnabled)
292290
return baseShellItem;
293291
}
294292

295-
public static T IsEnabled<T>(this T baseShellItem, Func<bool> isEnabledFunc)
293+
public static T IsEnabled<T>(this T baseShellItem, Func<bool> isEnabledFunc, IComponentWithState? componentWithState = null)
296294
where T : IBaseShellItem
297295
{
298-
//baseShellItem.IsEnabled = new PropertyValue<bool>(isEnabledFunc);
299-
baseShellItem.SetProperty(Microsoft.Maui.Controls.BaseShellItem.IsEnabledProperty, new PropertyValue<bool>(isEnabledFunc));
296+
baseShellItem.SetProperty(Microsoft.Maui.Controls.BaseShellItem.IsEnabledProperty, new PropertyValue<bool>(isEnabledFunc, componentWithState));
300297
return baseShellItem;
301298
}
302299

@@ -308,11 +305,10 @@ public static T Title<T>(this T baseShellItem, string title)
308305
return baseShellItem;
309306
}
310307

311-
public static T Title<T>(this T baseShellItem, Func<string> titleFunc)
308+
public static T Title<T>(this T baseShellItem, Func<string> titleFunc, IComponentWithState? componentWithState = null)
312309
where T : IBaseShellItem
313310
{
314-
//baseShellItem.Title = new PropertyValue<string>(titleFunc);
315-
baseShellItem.SetProperty(Microsoft.Maui.Controls.BaseShellItem.TitleProperty, new PropertyValue<string>(titleFunc));
311+
baseShellItem.SetProperty(Microsoft.Maui.Controls.BaseShellItem.TitleProperty, new PropertyValue<string>(titleFunc, componentWithState));
316312
return baseShellItem;
317313
}
318314

@@ -324,11 +320,10 @@ public static T IsVisible<T>(this T baseShellItem, bool isVisible)
324320
return baseShellItem;
325321
}
326322

327-
public static T IsVisible<T>(this T baseShellItem, Func<bool> isVisibleFunc)
323+
public static T IsVisible<T>(this T baseShellItem, Func<bool> isVisibleFunc, IComponentWithState? componentWithState = null)
328324
where T : IBaseShellItem
329325
{
330-
//baseShellItem.IsVisible = new PropertyValue<bool>(isVisibleFunc);
331-
baseShellItem.SetProperty(Microsoft.Maui.Controls.BaseShellItem.IsVisibleProperty, new PropertyValue<bool>(isVisibleFunc));
326+
baseShellItem.SetProperty(Microsoft.Maui.Controls.BaseShellItem.IsVisibleProperty, new PropertyValue<bool>(isVisibleFunc, componentWithState));
332327
return baseShellItem;
333328
}
334329

@@ -340,11 +335,10 @@ public static T FlyoutItemIsVisible<T>(this T baseShellItem, bool flyoutItemIsVi
340335
return baseShellItem;
341336
}
342337

343-
public static T FlyoutItemIsVisible<T>(this T baseShellItem, Func<bool> flyoutItemIsVisibleFunc)
338+
public static T FlyoutItemIsVisible<T>(this T baseShellItem, Func<bool> flyoutItemIsVisibleFunc, IComponentWithState? componentWithState = null)
344339
where T : IBaseShellItem
345340
{
346-
//baseShellItem.FlyoutItemIsVisible = new PropertyValue<bool>(flyoutItemIsVisibleFunc);
347-
baseShellItem.SetProperty(Microsoft.Maui.Controls.BaseShellItem.FlyoutItemIsVisibleProperty, new PropertyValue<bool>(flyoutItemIsVisibleFunc));
341+
baseShellItem.SetProperty(Microsoft.Maui.Controls.BaseShellItem.FlyoutItemIsVisibleProperty, new PropertyValue<bool>(flyoutItemIsVisibleFunc, componentWithState));
348342
return baseShellItem;
349343
}
350344

0 commit comments

Comments
 (0)