-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update mappers instead of replacing field values (#13836)
* Fix InputTransparent and CascadeInputTransparent * Adding some tests for the baseline * This works better * Fix this * Also these platforms * Support compatibility * Improved the sample for testing * See what this does * Revert "See what this does" This reverts commit 9609697. * comment out new tests * Try reverting these * Revert "Try reverting these" This reverts commit 31bfb34. * Revert the bad code hacks * This should work! * Use AppendToMapping for Focus commands * Use new PrependToMapping method * this * The entire method is replaced * Use AppendToMapping for Element and VisualElement * Skip the failing test for now * this is no longer needed * yaml * this * Revert "yaml" This reverts commit 51da889. * Revert "this" This reverts commit b7b1b3a. * this * Move some controls to use ModifyMapping * Added a test * Ensure iOS "text boxes" preserve cursor location * Fix the Windows tests * Attach the controls to the UI for focus tests * undo this * and this * obsolete for now * not Element yet * Adding some more "text box" tests * todo * tests * Revert "todo" This reverts commit 328c6ba. # Conflicts: # src/Controls/tests/DeviceTests/Elements/TextInput/TextInputTests.cs * this * move * Revert "this" This reverts commit d62b12a. * moar tests * Revert "Revert "todo"" This reverts commit 6065a41. * all working on windows * build all again * Merge the methods * Ensure iOS "text boxes" preserve cursor location * Fix the Windows tests * Attach the controls to the UI for focus tests * Adding some more "text box" tests * todo * tests * Revert "todo" This reverts commit 328c6ba. # Conflicts: # src/Controls/tests/DeviceTests/Elements/TextInput/TextInputTests.cs * this * move * Revert "this" This reverts commit d62b12a. * moar tests * Revert "Revert "todo"" This reverts commit 6065a41. * all working on windows * Merge the methods * removed as it is not needed * merge * Update src/Controls/tests/DeviceTests/ControlsHandlerTestBase.cs Co-authored-by: Rachel Kang <rachelkang@microsoft.com> * fix the variable names * fix * reset * Fix things a bit more * Improve test reports * fix things * Update Layout.Standard.cs * Update Layout.Standard.cs * not needed * ReplaceMapping * updates * Fix the mappers * this * Update AppHostBuilderExtensions.cs * ws --------- Co-authored-by: Rachel Kang <rachelkang@microsoft.com>
- Loading branch information
1 parent
484dd78
commit ed7809f
Showing
39 changed files
with
289 additions
and
259 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,22 @@ | ||
#nullable disable | ||
using System; | ||
|
||
namespace Microsoft.Maui.Controls | ||
{ | ||
public partial class Application | ||
{ | ||
[Obsolete("Use ApplicationHandler.Mapper instead.")] | ||
public static IPropertyMapper<IApplication, ApplicationHandler> ControlsApplicationMapper = | ||
new PropertyMapper<Application, ApplicationHandler>(ApplicationHandler.Mapper) | ||
{ | ||
#if ANDROID | ||
// There is also a mapper on Window for this property since this property is relevant at the window level for | ||
// Android not the application level | ||
[PlatformConfiguration.AndroidSpecific.Application.WindowSoftInputModeAdjustProperty.PropertyName] = MapWindowSoftInputModeAdjust, | ||
#endif | ||
}; | ||
new PropertyMapper<Application, ApplicationHandler>(ApplicationHandler.Mapper); | ||
|
||
internal static void RemapForControls() | ||
internal static new void RemapForControls() | ||
{ | ||
// Adjust the mappings to preserve Controls.Application legacy behaviors | ||
ApplicationHandler.Mapper = ControlsApplicationMapper; | ||
#if ANDROID | ||
// There is also a mapper on Window for this property since this property is relevant at the window level for | ||
// Android not the application level | ||
ApplicationHandler.Mapper.ReplaceMapping<Application, ApplicationHandler>(PlatformConfiguration.AndroidSpecific.Application.WindowSoftInputModeAdjustProperty.PropertyName, MapWindowSoftInputModeAdjust); | ||
#endif | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,19 @@ | ||
#nullable disable | ||
using System; | ||
|
||
namespace Microsoft.Maui.Controls | ||
{ | ||
public partial class DatePicker | ||
{ | ||
public static IPropertyMapper<IDatePicker, DatePickerHandler> ControlsDatePickerMapper = new PropertyMapper<DatePicker, DatePickerHandler>(DatePickerHandler.Mapper) | ||
{ | ||
#if IOS | ||
[PlatformConfiguration.iOSSpecific.DatePicker.UpdateModeProperty.PropertyName] = MapUpdateMode, | ||
#endif | ||
}; | ||
[Obsolete("Use DatePickerHandler.Mapper instead.")] | ||
public static IPropertyMapper<IDatePicker, DatePickerHandler> ControlsDatePickerMapper = new PropertyMapper<DatePicker, DatePickerHandler>(DatePickerHandler.Mapper); | ||
|
||
internal static new void RemapForControls() | ||
{ | ||
// Adjust the mappings to preserve Controls.DatePicker legacy behaviors | ||
DatePickerHandler.Mapper = ControlsDatePickerMapper; | ||
#if IOS | ||
DatePickerHandler.Mapper.ReplaceMapping<DatePicker, IDatePickerHandler>(PlatformConfiguration.iOSSpecific.DatePicker.UpdateModeProperty.PropertyName, MapUpdateMode); | ||
#endif | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,21 @@ | ||
using System; | ||
|
||
namespace Microsoft.Maui.Controls | ||
{ | ||
/// <include file="../../../docs/Microsoft.Maui.Controls/FlyoutPage.xml" path="Type[@FullName='Microsoft.Maui.Controls.FlyoutPage']/Docs/*" /> | ||
public partial class FlyoutPage | ||
{ | ||
public static IPropertyMapper<IFlyoutView, FlyoutViewHandler> ControlsFlyoutPageMapper = new PropertyMapper<IFlyoutView, FlyoutViewHandler>(FlyoutViewHandler.Mapper) | ||
{ | ||
[nameof(FlyoutLayoutBehavior)] = (handler, __) => handler.UpdateValue(nameof(IFlyoutView.FlyoutBehavior)), | ||
}; | ||
[Obsolete("Use FlyoutViewHandler.Mapper instead.")] | ||
public static IPropertyMapper<IFlyoutView, FlyoutViewHandler> ControlsFlyoutPageMapper = new PropertyMapper<IFlyoutView, FlyoutViewHandler>(FlyoutViewHandler.Mapper); | ||
|
||
internal new static void RemapForControls() | ||
{ | ||
FlyoutViewHandler.Mapper = ControlsFlyoutPageMapper; | ||
FlyoutViewHandler.Mapper.ReplaceMapping<IFlyoutView, IFlyoutViewHandler>(nameof(FlyoutLayoutBehavior), MapFlyoutLayoutBehavior); | ||
} | ||
|
||
internal static void MapFlyoutLayoutBehavior(IFlyoutViewHandler handler, IFlyoutView view) | ||
{ | ||
handler.UpdateValue(nameof(IFlyoutView.FlyoutBehavior)); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,37 @@ | ||
#nullable disable | ||
using System; | ||
using Microsoft.Maui.Handlers; | ||
|
||
namespace Microsoft.Maui.Controls | ||
{ | ||
/// <include file="../../../docs/Microsoft.Maui.Controls/Label.xml" path="Type[@FullName='Microsoft.Maui.Controls.Label']/Docs/*" /> | ||
public partial class Label | ||
{ | ||
public static IPropertyMapper<ILabel, LabelHandler> ControlsLabelMapper = new PropertyMapper<Label, LabelHandler>(LabelHandler.Mapper) | ||
{ | ||
[nameof(TextType)] = MapTextType, | ||
[nameof(Text)] = MapText, | ||
[nameof(FormattedText)] = MapText, | ||
[nameof(TextTransform)] = MapText, | ||
#if WINDOWS | ||
[PlatformConfiguration.WindowsSpecific.InputView.DetectReadingOrderFromContentProperty.PropertyName] = MapDetectReadingOrderFromContent, | ||
#endif | ||
#if IOS | ||
[nameof(TextDecorations)] = MapTextDecorations, | ||
[nameof(CharacterSpacing)] = MapCharacterSpacing, | ||
[nameof(LineHeight)] = MapLineHeight, | ||
[nameof(ILabel.Font)] = MapFont, | ||
[nameof(TextColor)] = MapTextColor, | ||
#endif | ||
[nameof(Label.LineBreakMode)] = MapLineBreakMode, | ||
[nameof(Label.MaxLines)] = MapMaxLines, | ||
}; | ||
[Obsolete("Use LabelHandler.Mapper instead.")] | ||
public static IPropertyMapper<ILabel, LabelHandler> ControlsLabelMapper = new PropertyMapper<Label, LabelHandler>(LabelHandler.Mapper); | ||
|
||
internal static new void RemapForControls() | ||
{ | ||
// Adjust the mappings to preserve Controls.Label legacy behaviors | ||
// ILabel does not include the TextType property, so we map it here to handle HTML text | ||
// And we map some of the other property handlers to Controls-specific versions that avoid stepping on HTML text settings | ||
|
||
LabelHandler.Mapper = ControlsLabelMapper; | ||
LabelHandler.Mapper.ReplaceMapping<Label, ILabelHandler>(nameof(TextType), MapTextType); | ||
LabelHandler.Mapper.ReplaceMapping<Label, ILabelHandler>(nameof(Text), MapText); | ||
LabelHandler.Mapper.ReplaceMapping<Label, ILabelHandler>(nameof(FormattedText), MapText); | ||
LabelHandler.Mapper.ReplaceMapping<Label, ILabelHandler>(nameof(TextTransform), MapText); | ||
#if WINDOWS | ||
LabelHandler.Mapper.ReplaceMapping<Label, ILabelHandler>(PlatformConfiguration.WindowsSpecific.InputView.DetectReadingOrderFromContentProperty.PropertyName, MapDetectReadingOrderFromContent); | ||
#endif | ||
#if IOS | ||
LabelHandler.Mapper.ModifyMapping<Label, ILabelHandler>(nameof(TextDecorations), MapTextDecorations); | ||
LabelHandler.Mapper.ModifyMapping<Label, ILabelHandler>(nameof(CharacterSpacing), MapCharacterSpacing); | ||
LabelHandler.Mapper.ModifyMapping<Label, ILabelHandler>(nameof(LineHeight), MapLineHeight); | ||
LabelHandler.Mapper.ModifyMapping<Label, ILabelHandler>(nameof(ILabel.Font), MapFont); | ||
LabelHandler.Mapper.ModifyMapping<Label, ILabelHandler>(nameof(TextColor), MapTextColor); | ||
#endif | ||
LabelHandler.Mapper.ReplaceMapping<Label, ILabelHandler>(nameof(Label.LineBreakMode), MapLineBreakMode); | ||
LabelHandler.Mapper.ReplaceMapping<Label, ILabelHandler>(nameof(Label.MaxLines), MapMaxLines); | ||
} | ||
} | ||
} |
Oops, something went wrong.