From 272d19fe8a97e9ad1d49008be68d0b54d6646e27 Mon Sep 17 00:00:00 2001 From: stm Date: Fri, 13 Jan 2023 14:49:37 +0100 Subject: [PATCH] Progress --- .../Components/Input/Input.razor | 8 ++-- .../Components/Input/Input.razor.cs | 37 ++++++++++++++----- 2 files changed, 30 insertions(+), 15 deletions(-) diff --git a/src/Connected.Components/Components/Input/Input.razor b/src/Connected.Components/Components/Input/Input.razor index 6f1fcf4..94b3ce5 100644 --- a/src/Connected.Components/Components/Input/Input.razor +++ b/src/Connected.Components/Components/Input/Input.razor @@ -2,14 +2,13 @@ @typeparam T @inherits InputBase -
- - -
+ diff --git a/src/Connected.Components/Components/Input/Input.razor.cs b/src/Connected.Components/Components/Input/Input.razor.cs index 9acac1b..6aa9ae2 100644 --- a/src/Connected.Components/Components/Input/Input.razor.cs +++ b/src/Connected.Components/Components/Input/Input.razor.cs @@ -2,8 +2,6 @@ using Connected.Utilities; using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components.Web; -using System.Numerics; -using System.Text.RegularExpressions; using System.Timers; namespace Connected.Components; @@ -140,7 +138,20 @@ public partial class Input : InputBase .AddClass($"px-1", Variant == Variant.Filled) .AddClass($"px-2", Variant == Variant.Outlined) .AddClass($"px-1", Variant == Variant.Text) - .AddClass(HelperContainerClassList); + .AddClass(CompiledClearButtonClassList.Build()) + .AddClass(CompiledHelperClassList.Build()); + } + } + + protected CssBuilder CompiledClearButtonClassList + { + get + { + return new CssBuilder() + .AddClass("me-n1", Adornment == Adornment.End && HideSpinButtons == false) + .AddClass("icon-button-edge-end", Adornment == Adornment.End && HideSpinButtons == true) + .AddClass("me-6", Adornment != Adornment.End && HideSpinButtons == false) + .AddClass("icon-button-edge-margin-end", Adornment != Adornment.End && HideSpinButtons == true); } } @@ -190,17 +201,23 @@ public partial class Input : InputBase protected string Classname => InputCssHelper.GetClassname(this, () => HasNativeHtmlPlaceholder() || !string.IsNullOrEmpty(Text) || Adornment == Adornment.Start || !string.IsNullOrWhiteSpace(Placeholder)); + protected CssBuilder CompiledClassList + { + get + { + return new CssBuilder("input-control-helper-container") + .AddClass($"px-1", Variant == Variant.Filled) + .AddClass($"px-2", Variant == Variant.Outlined) + .AddClass($"px-1", Variant == Variant.Text) + .AddClass(CompiledClearButtonClassList.Build()) + .AddClass(CompiledHelperClassList.Build()); + } + } + protected string InputClassname => InputCssHelper.GetInputClassname(this); protected string AdornmentClassname => InputCssHelper.GetAdornmentClassname(this); - protected string ClearButtonClassname => - new CssBuilder() - .AddClass("me-n1", Adornment == Adornment.End && HideSpinButtons == false) - .AddClass("icon-button-edge-end", Adornment == Adornment.End && HideSpinButtons == true) - .AddClass("me-6", Adornment != Adornment.End && HideSpinButtons == false) - .AddClass("icon-button-edge-margin-end", Adornment != Adornment.End && HideSpinButtons == true) - .Build(); /// /// Type of the input element. It should be a valid HTML5 input type.