Skip to content

Commit

Permalink
feat(blazorui): add missing base class from code behind of all compon…
Browse files Browse the repository at this point in the history
…ents #7905 (#7915)
  • Loading branch information
msynk committed Jun 30, 2024
1 parent 791a00e commit cdd3e73
Show file tree
Hide file tree
Showing 57 changed files with 202 additions and 152 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Bit.BlazorUI;

public partial class BitActionButton
public partial class BitActionButton : BitComponentBase
{
private int? _tabIndex;
private BitButtonType _buttonType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Bit.BlazorUI;

public partial class BitButton
public partial class BitButton : BitComponentBase
{
private BitSize? size;
private BitColor? color;
Expand Down Expand Up @@ -183,7 +183,7 @@ protected override void RegisterCssClasses()
BitButtonStyle.Text => "bit-btn-txt",
_ => "bit-btn-pri"
});

ClassBuilder.Register(() => Color switch
{
BitColor.Info => "bit-btn-inf",
Expand All @@ -193,7 +193,7 @@ protected override void RegisterCssClasses()
BitColor.Error => "bit-btn-err",
_ => string.Empty
});

ClassBuilder.Register(() => Size switch
{
BitSize.Small => "bit-btn-sm",
Expand Down Expand Up @@ -226,7 +226,7 @@ protected override void OnParametersSet()

base.OnParametersSet();
}

private string GetLabelPositionClass()
=> LoadingLabelPosition switch
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace Bit.BlazorUI;

public partial class BitButtonGroup<TItem> where TItem : class
public partial class BitButtonGroup<TItem> : BitComponentBase where TItem : class
{
private bool vertical;
private BitSize? size;
Expand Down Expand Up @@ -178,8 +178,8 @@ protected override Task OnParametersSetAsync()
return base.OnParametersSetAsync();
}



private string? GetItemClass(int index, bool isEnabled)
{
StringBuilder className = new StringBuilder();
Expand Down Expand Up @@ -220,7 +220,7 @@ protected override Task OnParametersSetAsync()
className.Append(" bit-btg-ilt");
}

if(isEnabled is false)
if (isEnabled is false)
{
className.Append(" bit-btg-ids");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Bit.BlazorUI;

public partial class BitCompoundButton
public partial class BitCompoundButton : BitComponentBase
{
private BitSize? size;
private BitColor? color;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Bit.BlazorUI;

public partial class BitIconButton
public partial class BitIconButton : BitComponentBase
{
private BitSize? size;

Expand Down Expand Up @@ -115,7 +115,7 @@ protected override void OnParametersSet()
{
_tabIndex = AllowDisabledFocus ? null : -1;
}

_buttonType = ButtonType ?? (EditContext is null ? BitButtonType.Button : BitButtonType.Submit);

base.OnParametersSet();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

namespace Bit.BlazorUI;

public partial class BitMenuButton<TItem> : IDisposable where TItem : class
public partial class BitMenuButton<TItem> : BitComponentBase, IDisposable where TItem : class
{
private bool SelectedItemHasBeenSet;

private bool isCalloutOpen;
private TItem selectedItem;
private TItem selectedItem = default!;
private BitButtonStyle buttonStyle = BitButtonStyle.Primary;

private string _calloutId = default!;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace Bit.BlazorUI;

public partial class BitToggleButton
public partial class BitToggleButton : BitComponentBase
{
private bool IsCheckedHasBeenSet;

Expand Down Expand Up @@ -175,7 +175,7 @@ protected override void RegisterCssClasses()
_ => string.Empty
});
}

protected override void RegisterCssStyles()
{
StyleBuilder.Register(() => Styles?.Root);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Bit.BlazorUI;

public partial class BitCalendar
public partial class BitCalendar : BitInputBase<DateTimeOffset?>
{
private const int DEFAULT_DAY_COUNT_PER_WEEK = 7;
private const int DEFAULT_WEEK_COUNT = 6;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Bit.BlazorUI;

public partial class BitCheckbox : IDisposable
public partial class BitCheckbox : BitInputBase<bool>, IDisposable
{
private bool IndeterminateHasBeenSet;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace Bit.BlazorUI;

public partial class BitChoiceGroup<TItem, TValue> where TItem : class
public partial class BitChoiceGroup<TItem, TValue> : BitInputBase<TValue> where TItem : class
{
private List<TItem> _items = [];
private string _labelId = default!;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Bit.BlazorUI;

public partial class BitDropdown<TItem, TValue> where TItem : class, new()
public partial class BitDropdown<TItem, TValue> : BitInputBase<TValue> where TItem : class, new()
{
private bool IsOpenHasBeenSet;
private bool ValuesHasBeenSet;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace Bit.BlazorUI;
/// <summary>
/// A component that wraps the HTML file input element and uploads them.
/// </summary>
public partial class BitFileUpload : IDisposable
public partial class BitFileUpload : BitComponentBase, IDisposable
{
private const int MIN_CHUNK_SIZE = 512 * 1024; // 512 kb
private const int MAX_CHUNK_SIZE = 10 * 1024 * 1024; // 10 mb
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Bit.BlazorUI;

public partial class BitOtpInput : IDisposable
public partial class BitOtpInput : BitInputBase<string?>, IDisposable
{
private string?[] _inputValues = default!;
private ElementReference[] _inputRefs = default!;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@

namespace Bit.BlazorUI;

public partial class BitRating
public partial class BitRating : BitInputBase<double>
{
private BitSize? size;



/// <summary>
/// Allow the initial rating value be 0. Note that a value of 0 still won't be selectable by mouse or keyboard.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Bit.BlazorUI;

public partial class BitSearchBox
public partial class BitSearchBox : BitInputBase<string?>
{
private bool isOpen;
private bool hideIcon;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Bit.BlazorUI;

public partial class BitSlider
public partial class BitSlider : BitComponentBase
{
private bool ValueHasBeenSet;
private bool UpperValueHasBeenSet;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Bit.BlazorUI;

public partial class BitSpinButton
public partial class BitSpinButton : BitInputBase<double>
{
private const int INITIAL_STEP_DELAY = 400;
private const int STEP_DELAY = 75;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,17 @@

namespace Bit.BlazorUI;

public partial class BitToggle
public partial class BitToggle : BitInputBase<bool>
{
private string? _labelledById;
private string? _stateText;
private string? _buttonId;
private string? _labelId;
private string? _buttonId;
private string? _stateText;
private string? _stateTextId;
private string? _labelledById;
private string? _ariaChecked => CurrentValueAsString;



/// <summary>
/// Custom CSS classes for different parts of the BitToggle.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
using System.Globalization;
using System.Text;
using System.Globalization;
using System.Diagnostics.CodeAnalysis;
using System.Text;

namespace Bit.BlazorUI;

public partial class BitCircularTimePicker
public partial class BitCircularTimePicker : BitInputBase<TimeSpan?>
{
private const string FORMAT_24_HOURS = "HH:mm";
private const string FORMAT_12_HOURS = "hh:mm tt";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace Bit.BlazorUI;

public partial class BitColorPicker : IDisposable
public partial class BitColorPicker : BitComponentBase, IDisposable
{
private bool ColorHasBeenSet;
private bool AlphaHasBeenSet;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Bit.BlazorUI;

public partial class BitDatePicker
public partial class BitDatePicker : BitInputBase<DateTimeOffset?>
{
private const int DEFAULT_DAY_COUNT_PER_WEEK = 7;
private const int DEFAULT_WEEK_COUNT = 6;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Bit.BlazorUI;

public partial class BitDateRangePicker
public partial class BitDateRangePicker : BitInputBase<BitDateRangePickerValue?>
{
private const int DEFAULT_DAY_COUNT_PER_WEEK = 7;
private const int DEFAULT_WEEK_COUNT = 6;
Expand Down Expand Up @@ -1539,7 +1539,7 @@ private void UpdateTime()
if (CurrentValue is null) return;
if (CurrentValue.StartDate.HasValue is false && CurrentValue.EndDate.HasValue is false) return;

var isEndGreaterInOneDayRange = CurrentValue.StartDate.HasValue &&
var isEndGreaterInOneDayRange = CurrentValue.StartDate.HasValue &&
CurrentValue.EndDate.HasValue &&
CurrentValue.StartDate!.Value.Date == CurrentValue.EndDate!.Value.Date &&
new TimeSpan(_startTimeHour, _startTimeMinute, 0) > new TimeSpan(_endTimeHour, _endTimeMinute, 0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,23 @@

namespace Bit.BlazorUI;

public partial class BitTimePicker
public partial class BitTimePicker : BitInputBase<TimeSpan?>
{
private const int STEP_DELAY = 75;
private const int INITIAL_STEP_DELAY = 400;
private const string FORMAT_24_HOURS = "HH:mm";
private const string FORMAT_12_HOURS = "hh:mm tt";


private bool isOpen;

private bool IsOpenHasBeenSet;

private bool isOpen;
private CultureInfo culture = CultureInfo.CurrentUICulture;
private BitIconLocation iconLocation = BitIconLocation.Right;

private string focusClass = string.Empty;

private int? _hour;
private int? _minute;
private string? _labelId;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
namespace Bit.BlazorUI;

public partial class BitFooter
public partial class BitFooter : BitComponentBase
{
private bool @fixed;
private int? height;



/// <summary>
/// Gets or sets the content to be rendered inside the BitFooter.
/// </summary>
Expand All @@ -13,7 +15,7 @@ public partial class BitFooter
/// <summary>
/// Gets or sets the height of the BitFooter (in pixels).
/// </summary>
[Parameter]
[Parameter]
public int? Height
{
get => height;
Expand All @@ -29,7 +31,7 @@ public partial class BitFooter
/// <summary>
/// Renders the footer with a fixed position at the bottom of the page.
/// </summary>
[Parameter]
[Parameter]
public bool Fixed
{
get => @fixed;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace Bit.BlazorUI;

public partial class BitGrid
public partial class BitGrid : BitComponentBase
{
private static readonly Dictionary<BitGridAlignment, string> _AlignmentMap = new()
{
Expand All @@ -15,6 +15,7 @@ public partial class BitGrid
};



private int span = 1;
private int columns = 12;
private string spacing = "4px";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
namespace Bit.BlazorUI;

public partial class BitHeader
public partial class BitHeader : BitComponentBase
{
private bool @fixed;
private int? height;



/// <summary>
/// Gets or sets the content to be rendered inside the BitHeader.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace Bit.BlazorUI;

public partial class BitLayout
public partial class BitLayout : BitComponentBase
{
/// <summary>
/// Custom CSS classes for different parts of the BitLayout.
Expand Down
Loading

0 comments on commit cdd3e73

Please sign in to comment.