Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Docs] Fix Tabs Dynamic example #2341

Merged
merged 3 commits into from
Jul 8, 2024
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 @@ -8482,6 +8482,12 @@
Gets or sets a value indicating whether the active indicator is displayed.
</summary>
</member>
<member name="P:Microsoft.FluentUI.AspNetCore.Components.FluentTabs.ShowOverflow">
<summary>
Gets or sets whether tabs can overflow
Default is set to true to maintain original behavior.
</summary>
</member>
<member name="P:Microsoft.FluentUI.AspNetCore.Components.FluentTabs.ChildContent">
<summary>
Gets or sets the content to be rendered inside the component.
Expand Down
14 changes: 14 additions & 0 deletions examples/Demo/Shared/Pages/NumberField/NumberFieldPage.razor
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,20 @@
Fluent UI design system.
</p>

<blockquote>
<p>
<strong>Note:</strong> The underlying web component is known to have <a href="https://github.com/microsoft/fast/issues?q=is%3Aissue+numberfield+is%3Aclosed">quite some issues</a>
which won't get fixed (and can't be fixed on out side). Be carefull when choosing to use this component.
</p>
<p>
Also, we'd advise in general to not use a NumberField for this kind of input See also <a href="https://technology.blog.gov.uk/2020/02/24/why-the-gov-uk-design-system-team-changed-the-input-type-for-numbers/">this article</a> for reasons and alternatives
</p>
<p>
As an alternative, you could consider using a <a href="https://github.com/microsoft/fluentui-blazor/issues/1345#issuecomment-2145145944">standard InputNumber with styling applied</a>.
</p>
</blockquote>


<h2 id="example">Examples</h2>

<DemoSection Title="Default" Component="@typeof(NumberFieldDefault)" ></DemoSection>
Expand Down
13 changes: 8 additions & 5 deletions src/Core/Components/Tabs/FluentTabs.razor
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
@namespace Microsoft.FluentUI.AspNetCore.Components
@inherits FluentComponentBase
<CascadingValue Value="this" IsFixed="true">
@{
var _overflow = TabsOverflow;
}
<CascadingValue Value="this">
<fluent-tabs @ref=Element
id="@Id"
class="@ClassValue"
Expand All @@ -11,17 +14,17 @@
@ontabchange="HandleOnTabChangedAsync"
@attributes="AdditionalAttributes">
@ChildContent
@if (TabsOverflow.Any())
@if (_overflow.Any())
{
<FluentBadge Id="@IdMoreButton" Appearance="Appearance.Neutral" Style="@StyleMoreValues" slot="end">
@($"+{TabsOverflow.Count()}")
@($"+{_overflow.Count()}")
</FluentBadge>
}
</fluent-tabs>
@if (TabsOverflow.Any())
@if (_overflow.Any())
{
<FluentMenu Anchor="@IdMoreButton" Trigger="MouseButton.Left" Anchored="true">
@foreach (var item in TabsOverflow)
@foreach (var item in _overflow)
{
<FluentMenuItem Label="@item.Label" OnClick="@((e) => DisplayMoreTabAsync(item))" />
}
Expand Down
4 changes: 1 addition & 3 deletions src/Core/Components/Tabs/FluentTabs.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,6 @@ protected override async Task OnAfterRenderAsync(bool firstRender)
{
if (firstRender)
{

_dotNetHelper = DotNetObjectReference.Create(this);
// Overflow
_jsModuleOverflow = await JSRuntime.InvokeAsync<IJSObjectReference>("import",
Expand All @@ -162,7 +161,6 @@ private async Task HandleOnTabChangedAsync(TabChangeEventArgs args)
ActiveTabId = tabId;
await ActiveTabIdChanged.InvokeAsync(tabId);
}

}

internal int RegisterTab(FluentTab tab)
Expand Down Expand Up @@ -238,7 +236,7 @@ public async Task OverflowRaisedAsync(string value)
private async Task ResizeTabsForOverflowButtonAsync()
{
var horizontal = Orientation == Orientation.Horizontal;
await _jsModuleOverflow.InvokeVoidAsync("fluentOverflowResized", _dotNetHelper, Id, horizontal, FLUENT_TAB_TAG);
await _jsModuleOverflow.InvokeVoidAsync("fluentOverflowRefresh", _dotNetHelper, Id, horizontal, FLUENT_TAB_TAG);
}

/// <summary />
Expand Down
Loading