Skip to content

Commit f8be652

Browse files
authored
DateWheelPicker Adornment Options (#516)
1 parent 6b2235b commit f8be652

File tree

3 files changed

+21
-5
lines changed

3 files changed

+21
-5
lines changed

CodeBeam.MudBlazor.Extensions.Docs/Pages/Components/DateWheelPicker/Examples/DateWheelPickerExample1.razor

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@
33

44
<MudGrid>
55
<MudItem xs="12" sm="8">
6-
<MudDateWheelPicker @bind-Value="_date" DateView="_dateView" Editable="_editable" Label="Date" Clearable
7-
ShowToolbar="_showToolbar" ShowHeader="_showHeader" SubmitOnClose="_submitOnClose" Variant="Variant.Outlined" Color="_color" ColorTime="_colorTime"
8-
DateFormat="@_dateFormat" FixDay="_fixDay" FixMonth="_fixMonth" FixYear="_fixYear" FixHour="_fixHour" FixMinute="_fixMinute" FixSecond="_fixSecond" />
6+
<MudDateWheelPicker @bind-Value="_date" DateView="_dateView" Editable="_editable" Label="Date" Clearable InputAdornment="@(_isAdornmentEnd ? Adornment.End : Adornment.Start)"
7+
ShowToolbar="_showToolbar" ShowHeader="_showHeader" SubmitOnClose="_submitOnClose" Variant="Variant.Outlined" Color="_color" ColorTime="_colorTime"
8+
DateFormat="@_dateFormat" FixDay="_fixDay" FixMonth="_fixMonth" FixYear="_fixYear" FixHour="_fixHour" FixMinute="_fixMinute" FixSecond="_fixSecond"
9+
TransformOrigin="Origin.TopCenter" AnchorOrigin="Origin.BottomCenter" />
910
</MudItem>
1011

1112
<MudItem xs="12" sm="4">
@@ -20,6 +21,7 @@
2021
<MudSwitchM3 @bind-Value="_showToolbar" Color="Color.Secondary" Label="Show Toolbar" />
2122
<MudSwitchM3 @bind-Value="_showHeader" Color="Color.Secondary" Label="Show Header" />
2223
<MudSwitchM3 @bind-Value="_submitOnClose" Color="Color.Secondary" Label="Submit On Close" />
24+
<MudSwitchM3 @bind-Value="_isAdornmentEnd" Label="Adornment End" Color="Color.Secondary" />
2325
<MudSelect @bind-Value="_color" Variant="Variant.Outlined" Label="Color">
2426
@foreach (Color item in Enum.GetValues<Color>())
2527
{
@@ -62,4 +64,5 @@
6264
bool _fixHour;
6365
bool _fixMinute;
6466
bool _fixSecond;
67+
bool _isAdornmentEnd = true;
6568
}

CodeBeam.MudBlazor.Extensions/Components/DateWheelPicker/MudDateWheelPicker.razor

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
TextUpdateSuppression="false"
1212
Value="@(Text)" Underline="@Underline"
1313
Disabled="@Disabled" ReadOnly="!Editable" Error="@Error" ErrorId="@ErrorId"
14-
OnAdornmentClick="HandleAdornmentClick" AdornmentIcon="@_currentIcon" Adornment="Adornment.End"
14+
OnAdornmentClick="HandleAdornmentClick" AdornmentIcon="@InputAdornmentIcon" Adornment="@InputAdornment"
1515
AdornmentColor="@AdornmentColor" IconSize="@IconSize" OnBlur="HandleOnBlur"
1616
Clearable="@Clearable" OnClearButtonClick="HandleClearButtonClick"
1717
@attributes="UserAttributes" />

CodeBeam.MudBlazor.Extensions/Components/DateWheelPicker/MudDateWheelPicker.razor.cs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,20 @@ protected override void OnInitialized()
235235
public int MaxHeight { get; set; } = 300;
236236

237237
internal bool _isOpen;
238-
internal string _currentIcon { get; set; } = Icons.Material.Filled.CalendarMonth;
238+
239+
/// <summary>
240+
/// The icon displayed as adornment in input.
241+
/// </summary>
242+
[Parameter]
243+
[Category(CategoryTypes.FormComponent.ListAppearance)]
244+
public string? InputAdornmentIcon { get; set; } = Icons.Material.Filled.CalendarMonth;
245+
246+
/// <summary>
247+
/// The adornment position in input.
248+
/// </summary>
249+
[Parameter]
250+
[Category(CategoryTypes.FormComponent.ListAppearance)]
251+
public Adornment InputAdornment { get; set; } = Adornment.End;
239252

240253
/// <summary>
241254
/// Sets the anchor origin point for the popover.

0 commit comments

Comments
 (0)