Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3050,6 +3050,11 @@
<member name="P:Microsoft.FluentUI.AspNetCore.Components.FluentDatePicker.PopupId">
<summary />
</member>
<member name="P:Microsoft.FluentUI.AspNetCore.Components.FluentDatePicker.TextField">
<summary>
Holds the reference to the internal <see cref="T:Microsoft.FluentUI.AspNetCore.Components.FluentTextField"/> component.
</summary>
</member>
<member name="P:Microsoft.FluentUI.AspNetCore.Components.FluentDatePicker.Appearance">
<summary>
Gets or sets the design of this input.
Expand Down
2 changes: 1 addition & 1 deletion src/Core/Components/Base/FluentInputBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ public override Task SetParametersAsync(ParameterView parameters)
/// Exposes the elements FocusAsync() method.
/// </summary>
[SuppressMessage("Style", "VSTHRD200:Use `Async` suffix for async methods", Justification = "#vNext: To update in the next version")]
public async void FocusAsync()
public virtual async void FocusAsync()
{
await Element!.FocusAsync();
}
Expand Down
77 changes: 39 additions & 38 deletions src/Core/Components/DateTime/FluentDatePicker.razor
Original file line number Diff line number Diff line change
Expand Up @@ -2,46 +2,47 @@
@inherits FluentCalendarBase

<FluentInputLabel ForId="@Id" Label="@Label" AriaLabel="@AriaLabel" ChildContent="@LabelTemplate" Required="@Required" />
<FluentTextField Id="@Id"
Embedded="true"
Class="@ClassValue"
Style="@StyleValue"
AutoComplete="off"
Autofocus="@Autofocus"
Appearance="@Appearance"
@bind-Value="@CurrentValueAsString"
@onclick="@OnCalendarOpenHandlerAsync"
@ondblclick="@OnDoubleClickHandlerAsync"
@onkeydown="(e => KeyDown.SimulateClickAsync(e, OnCalendarOpenHandlerAsync))"
ReadOnly="@ReadOnly"
Disabled="@Disabled"
Required="@Required"
Placeholder="@(Placeholder ?? PlaceholderAccordingToView())"
Name="@Name"
@attributes="@AdditionalAttributes">
@((MarkupString)CalendarIcon)
<FluentTextField @ref="TextField"
Id="@Id"
Embedded="true"
Class="@ClassValue"
Style="@StyleValue"
AutoComplete="off"
Autofocus="@Autofocus"
Appearance="@Appearance"
@bind-Value="@CurrentValueAsString"
@onclick="@OnCalendarOpenHandlerAsync"
@ondblclick="@OnDoubleClickHandlerAsync"
@onkeydown="(e => KeyDown.SimulateClickAsync(e, OnCalendarOpenHandlerAsync))"
ReadOnly="@ReadOnly"
Disabled="@Disabled"
Required="@Required"
Placeholder="@(Placeholder ?? PlaceholderAccordingToView())"
Name="@Name"
@attributes="@AdditionalAttributes">
@((MarkupString)CalendarIcon)
</FluentTextField>

@if (Opened)
{
<FluentOverlay @bind-Visible="@Opened" Dismissable="true" FullScreen="true" Interactive="true" InteractiveExceptId="@PopupId" />
<FluentAnchoredRegion Anchor="@Id"
Id="@PopupId"
HorizontalDefaultPosition="@(PopupHorizontalPosition ?? (System.Globalization.CultureInfo.CurrentUICulture.TextInfo.IsRightToLeft ? HorizontalPosition.Left : HorizontalPosition.Right))"
HorizontalInset="true"
VerticalDefaultPosition="@VerticalPosition.Unset"
Shadow="ElevationShadow.Flyout"
Class="fluent-datepicker-popup"
Style="@($"z-index: {ZIndex.DatePickerPopup}; border-radius: calc(var(--control-corner-radius) * 1px); padding: 12px;")">
<FluentCalendar Culture="@Culture"
View="@View"
DayFormat="@DayFormat"
DisabledDateFunc="@DisabledDateFunc"
DisabledCheckAllDaysOfMonthYear="@DisabledCheckAllDaysOfMonthYear"
DisabledSelectable="@DisabledSelectable"
Value="@Value"
ValueChanged="@OnSelectedDateAsync"
DaysTemplate="@DaysTemplate"
PickerMonthChanged="@PickerMonthChanged" />
</FluentAnchoredRegion>
<FluentOverlay @bind-Visible="@Opened" Dismissable="true" FullScreen="true" Interactive="true" InteractiveExceptId="@PopupId" />
<FluentAnchoredRegion Anchor="@Id"
Id="@PopupId"
HorizontalDefaultPosition="@(PopupHorizontalPosition ?? (System.Globalization.CultureInfo.CurrentUICulture.TextInfo.IsRightToLeft ? HorizontalPosition.Left : HorizontalPosition.Right))"
HorizontalInset="true"
VerticalDefaultPosition="@VerticalPosition.Unset"
Shadow="ElevationShadow.Flyout"
Class="fluent-datepicker-popup"
Style="@($"z-index: {ZIndex.DatePickerPopup}; border-radius: calc(var(--control-corner-radius) * 1px); padding: 12px;")">
<FluentCalendar Culture="@Culture"
View="@View"
DayFormat="@DayFormat"
DisabledDateFunc="@DisabledDateFunc"
DisabledCheckAllDaysOfMonthYear="@DisabledCheckAllDaysOfMonthYear"
DisabledSelectable="@DisabledSelectable"
Value="@Value"
ValueChanged="@OnSelectedDateAsync"
DaysTemplate="@DaysTemplate"
PickerMonthChanged="@PickerMonthChanged" />
</FluentAnchoredRegion>
}
10 changes: 10 additions & 0 deletions src/Core/Components/DateTime/FluentDatePicker.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ protected override string? ClassValue
/// <summary />
private string PopupId => $"{Id}-popup";

/// <summary>
/// Holds the reference to the internal <see cref="FluentTextField"/> component.
/// </summary>
private FluentTextField TextField { get; set; } = default!;

/// <summary>
/// Gets or sets the design of this input.
/// </summary>
Expand Down Expand Up @@ -153,4 +158,9 @@ private string PlaceholderAccordingToView()
CalendarViews.Months => Culture.DateTimeFormat.YearMonthPattern,
_ => Culture.DateTimeFormat.ShortDatePattern
};

public override void FocusAsync()
{
TextField?.FocusAsync();
}
}
3 changes: 2 additions & 1 deletion src/Core/Components/DateTime/FluentTimePicker.razor
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
ο»Ώ@namespace Microsoft.FluentUI.AspNetCore.Components
@inherits FluentInputBase<DateTime?>
<FluentInputLabel ForId="@Id" Label="@Label" AriaLabel="@AriaLabel" ChildContent="@LabelTemplate" Required="@Required" />
<fluent-text-field class="@($"{ClassValue} fluent-timepicker")"
<fluent-text-field @ref="Element"
class="@($"{ClassValue} fluent-timepicker")"
style="@StyleValue"
id="@Id"
autofocus="@Autofocus"
Expand Down
Loading