From eec7dff33e4c604c4202683dfa0d1bba8dde306d Mon Sep 17 00:00:00 2001 From: capdiem Date: Fri, 9 Aug 2024 10:32:28 +0800 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=20refactor(Input):=20active=20color?= =?UTF-8?q?=20no=20longer=20distinguishes=20themes,=20defaults=20to=20prim?= =?UTF-8?q?ary=20(#2087)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Masa.Blazor/Components/Input/MInput.razor.cs | 4 ++-- .../Components/Slider/MSliderBase.razor.cs | 2 -- .../Components/TextField/MTextField.razor.cs | 13 +------------ 3 files changed, 3 insertions(+), 16 deletions(-) diff --git a/src/Masa.Blazor/Components/Input/MInput.razor.cs b/src/Masa.Blazor/Components/Input/MInput.razor.cs index 3fbf5b2ea8..b98ff967a1 100644 --- a/src/Masa.Blazor/Components/Input/MInput.razor.cs +++ b/src/Masa.Blazor/Components/Input/MInput.razor.cs @@ -11,7 +11,7 @@ public partial class MInput : MasaComponentBase, IThemeable, IFilterInpu [CascadingParameter(Name = "AppIsDark")] protected bool AppIsDark { get; set; } - [Parameter] public virtual string? Color { get; set; } + [Parameter][MasaApiParameter("primary")] public string? Color { get; set; } = "primary"; [Parameter] public string? BackgroundColor { get; set; } @@ -224,7 +224,7 @@ public void StateHasChangedForJsInvokable() #endregion - public virtual string? ComputedColor => IsDisabled ? null : Color ?? (IsDark && !AppIsDark ? "white" : "black"); + public virtual string? ComputedColor => IsDisabled ? null : Color; public virtual bool HasColor => false; diff --git a/src/Masa.Blazor/Components/Slider/MSliderBase.razor.cs b/src/Masa.Blazor/Components/Slider/MSliderBase.razor.cs index b7ca792982..de73631069 100644 --- a/src/Masa.Blazor/Components/Slider/MSliderBase.razor.cs +++ b/src/Masa.Blazor/Components/Slider/MSliderBase.razor.cs @@ -28,8 +28,6 @@ public partial class MSliderBase : MInput, IOutsideCli [Parameter] [MasaApiParameter(false)] public StringBoolean Ticks { get; set; } = false; - [Parameter] [MasaApiParameter("primary")] public override string? Color { get; set; } = "primary"; - [Parameter] public string? TrackColor { get; set; } [Parameter] public string? TrackFillColor { get; set; } diff --git a/src/Masa.Blazor/Components/TextField/MTextField.razor.cs b/src/Masa.Blazor/Components/TextField/MTextField.razor.cs index 2aaec3c9eb..ef2a98d02a 100644 --- a/src/Masa.Blazor/Components/TextField/MTextField.razor.cs +++ b/src/Masa.Blazor/Components/TextField/MTextField.razor.cs @@ -181,18 +181,7 @@ public virtual bool Outlined public bool HasCounter => Counter != false && Counter != null; - public override string? ComputedColor - { - get - { - if (!SoloInverted || !IsFocused) - { - return base.ComputedColor; - } - - return Color ?? "primary"; - } - } + public override string? ComputedColor => !SoloInverted || !IsFocused ? base.ComputedColor : Color; public override bool HasColor => IsFocused;