-
Notifications
You must be signed in to change notification settings - Fork 472
[dev-v5][Overflow] refactor to wrap web component #4961
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
Open
vnbaaij
wants to merge
11
commits into
dev-v5
Choose a base branch
from
users/vnbaaij/dev-v5/refactor-overflow
base: dev-v5
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
b404d1b
Initial refactoring work
vnbaaij e3ba815
Merge branch 'dev-v5' into users/vnbaaij/dev-v5/refactor-overflow
vnbaaij f31dc6b
refactor: migrate overflow to web component
vnbaaij 9dafc80
Merge branch 'dev-v5' into users/vnbaaij/dev-v5/refactor-overflow
vnbaaij b3451f8
- Add more tests
vnbaaij 5b408e2
- Process review comments
vnbaaij 0c53dd2
Merge branch 'dev-v5' into users/vnbaaij/dev-v5/refactor-overflow
vnbaaij e96920e
Merge branch 'dev-v5' into users/vnbaaij/dev-v5/refactor-overflow
dvoituron 623629b
Update migration doc to align with formatting changes
vnbaaij 2cdb04d
Merge branch 'dev-v5' into users/vnbaaij/dev-v5/refactor-overflow
dvoituron 9c360fd
Merge branch 'dev-v5' into users/vnbaaij/dev-v5/refactor-overflow
dvoituron File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 14 additions & 14 deletions
28
...emo/FluentUI.Demo.Client/Documentation/Components/Overflow/Examples/OverflowDefault.razor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,18 +1,18 @@ | ||
| ο»Ώ<div id="example1" style="background-color: var(--colorNeutralBackground4); overflow: auto; resize: horizontal; padding: 10px; min-width: 55px;"> | ||
| <FluentOverflow> | ||
| <FluentOverflowItem><FluentBadge Content="Blazor"></FluentBadge></FluentOverflowItem> | ||
| <FluentOverflowItem><FluentBadge Content="Microsoft"></FluentBadge></FluentOverflowItem> | ||
| <FluentOverflowItem><FluentBadge Content="Azure"></FluentBadge></FluentOverflowItem> | ||
| <FluentOverflowItem><FluentBadge Content="DevOps"></FluentBadge></FluentOverflowItem> | ||
| <FluentOverflowItem><FluentBadge Content="Framework"></FluentBadge></FluentOverflowItem> | ||
| <FluentOverflowItem><FluentBadge Content="Office"></FluentBadge></FluentOverflowItem> | ||
| <FluentOverflowItem><FluentBadge Content="Installation"></FluentBadge></FluentOverflowItem> | ||
| <FluentOverflowItem><FluentBadge Content="Blazor"></FluentBadge></FluentOverflowItem> | ||
| <FluentOverflowItem><FluentBadge Content="Microsoft"></FluentBadge></FluentOverflowItem> | ||
| <FluentOverflowItem><FluentBadge Content="Azure"></FluentBadge></FluentOverflowItem> | ||
| <FluentOverflowItem><FluentBadge Content="DevOps"></FluentBadge></FluentOverflowItem> | ||
| <FluentOverflowItem><FluentBadge Content="Framework"></FluentBadge></FluentOverflowItem> | ||
| <FluentOverflowItem><FluentBadge Content="Office"></FluentBadge></FluentOverflowItem> | ||
| <FluentOverflowItem><FluentBadge Content="Installation"></FluentBadge></FluentOverflowItem> | ||
| <FluentBadge Content="Blazor"></FluentBadge> | ||
| <FluentBadge Content="Microsoft"></FluentBadge> | ||
| <FluentBadge Content="Azure"></FluentBadge> | ||
| <FluentBadge Content="DevOps"></FluentBadge> | ||
| <FluentBadge Content="Framework"></FluentBadge> | ||
| <FluentBadge Content="Office"></FluentBadge> | ||
| <FluentBadge Content="Installation"></FluentBadge> | ||
| <FluentBadge Content="Blazor"></FluentBadge> | ||
| <FluentBadge Content="Microsoft"></FluentBadge> | ||
| <FluentBadge Content="Azure"></FluentBadge> | ||
| <FluentBadge Content="DevOps"></FluentBadge> | ||
| <FluentBadge Content="Framework"></FluentBadge> | ||
| <FluentBadge Content="Office"></FluentBadge> | ||
| <FluentBadge Content="Installation"></FluentBadge> | ||
| </FluentOverflow> | ||
| </div> |
10 changes: 5 additions & 5 deletions
10
...mo/FluentUI.Demo.Client/Documentation/Components/Overflow/Examples/OverflowEllipsis.razor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,9 +1,9 @@ | ||
| ο»Ώ<div id="example2" style="background-color: var(--colorNeutralBackground4); overflow: auto; resize: horizontal; padding: 10px; min-width: 94px;"> | ||
| <FluentOverflow> | ||
| <FluentOverflowItem Fixed="OverflowItemFixed.Ellipsis">Aspire;</FluentOverflowItem> | ||
| <FluentOverflowItem>Blazor;</FluentOverflowItem> | ||
| <FluentOverflowItem>Microsoft;</FluentOverflowItem> | ||
| <FluentOverflowItem>Azure;</FluentOverflowItem> | ||
| <FluentOverflowItem>DevOps</FluentOverflowItem> | ||
| <div fixed="ellipsis">Aspire;</div> | ||
| <div fixed="ellipsis">Blazor;</div> | ||
| <div>Microsoft;</div> | ||
| <div>Azure;</div> | ||
| <div>DevOps</div> | ||
| </FluentOverflow> | ||
| </div> |
41 changes: 41 additions & 0 deletions
41
...o.Client/Documentation/Components/Overflow/Examples/OverflowMaxRenderedItemsExample.razor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| ο»Ώ<div style="background-color: var(--colorNeutralBackground4); overflow: auto; resize: horizontal; padding: 10px; min-width: 160px;"> | ||
| <FluentOverflow @ref="_overflow" | ||
| MaxRenderedItems="2" | ||
| OnOverflowRaised="OnOverflowRaised"> | ||
| <ChildContent> | ||
| <FluentBadge Content="Blazor" /> | ||
| <FluentBadge Content="Microsoft" /> | ||
| <FluentBadge Content="Azure" /> | ||
| <FluentBadge Content="DevOps" /> | ||
| <FluentBadge Content="Framework" /> | ||
| <FluentBadge Content="Office" /> | ||
| </ChildContent> | ||
| <OverflowTemplate> | ||
| <FluentTooltip Anchor="@context.IdMoreButton" UseTooltipService="false"> | ||
| <div style="display: flex; flex-direction: column; gap: 6px; margin: 8px;"> | ||
| @foreach (var item in context.ItemsOverflow) | ||
| { | ||
| <FluentBadge Content="@item.Text" /> | ||
| } | ||
| </div> | ||
| </FluentTooltip> | ||
| </OverflowTemplate> | ||
| </FluentOverflow> | ||
| </div> | ||
| <div style="margin-top: 8px;"> | ||
| <div>Total overflow count: @_overflowCount</div> | ||
| <div>Rendered in payload (MaxRenderedItems=2): @_renderedInPayloadCount</div> | ||
| </div> | ||
|
|
||
| @code | ||
| { | ||
| private FluentOverflow? _overflow; | ||
| private int _overflowCount; | ||
| private int _renderedInPayloadCount; | ||
|
|
||
| private void OnOverflowRaised(IEnumerable<FluentOverflow.OverflowItem> items) | ||
| { | ||
| _renderedInPayloadCount = items.Count(); | ||
| _overflowCount = _overflow?.OverflowCount ?? 0; | ||
| } | ||
| } |
9 changes: 9 additions & 0 deletions
9
...Client/Documentation/Components/Overflow/Examples/OverflowMultipleFixedItemsExample.razor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| ο»Ώ<div style="background-color: var(--colorNeutralBackground4); overflow: auto; resize: horizontal; padding: 10px; min-width: 120px;"> | ||
| <FluentOverflow> | ||
| <div fixed="ellipsis">Aspire;</div> | ||
| <div fixed="ellipsis">Blazor;</div> | ||
| <FluentBadge>Microsoft</FluentBadge> | ||
| <FluentBadge>Azure</FluentBadge> | ||
| <FluentBadge>DevOps</FluentBadge> | ||
| </FluentOverflow> | ||
| </div> |
11 changes: 11 additions & 0 deletions
11
...ntUI.Demo.Client/Documentation/Components/Overflow/Examples/OverflowSelectorExample.razor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| ο»Ώ<div style="background-color: var(--colorNeutralBackground4); overflow: auto; resize: horizontal; padding: 10px; min-width: 230px;"> | ||
| <FluentOverflow Selector=".overflow-item"> | ||
| <div fixed="fixed" style="background: var(--fill-color); border: dashed 1px green; padding: 2px 8px;">Pinned</div> | ||
| <div class="overflow-item" style="background: var(--colorNeutralBackground2); border: dashed 1px blue; padding: 2px 8px;">Blazor</div> | ||
| <div class="overflow-item" style="background: var(--colorNeutralBackground2); border: dashed 1px blue; padding: 2px 8px;">Microsoft</div> | ||
| <div class="overflow-item" style="background: var(--colorNeutralBackground2); border: dashed 1px blue; padding: 2px 8px;">Azure</div> | ||
| <div fixed="fixed" style="background: var(--colorPaletteGreenBackground2); border: dashed 1px green; padding: 2px 8px;">Always visible</div> | ||
| <div class="overflow-item" style="background: var(--colorNeutralBackground2); border: dashed 1px blue; padding: 2px 8px;">DevOps</div> | ||
| <div class="overflow-item" style="background: var(--colorNeutralBackground2); border: dashed 1px blue; padding: 2px 8px;">Framework</div> | ||
| </FluentOverflow> | ||
| </div> |
28 changes: 14 additions & 14 deletions
28
...uentUI.Demo.Client/Documentation/Components/Overflow/Examples/OverflowVisibleOnLoad.razor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,18 +1,18 @@ | ||
| ο»Ώ<div id="example3" style="background-color: var(--colorNeutralBackground4); overflow: auto; resize: horizontal; padding: 10px; min-width: 55px;"> | ||
| <FluentOverflow VisibleOnLoad="false"> | ||
| <FluentOverflowItem><FluentBadge Content="Blazor"></FluentBadge></FluentOverflowItem> | ||
| <FluentOverflowItem><FluentBadge Content="Microsoft"></FluentBadge></FluentOverflowItem> | ||
| <FluentOverflowItem><FluentBadge Content="Azure"></FluentBadge></FluentOverflowItem> | ||
| <FluentOverflowItem><FluentBadge Content="DevOps"></FluentBadge></FluentOverflowItem> | ||
| <FluentOverflowItem><FluentBadge Content="Framework"></FluentBadge></FluentOverflowItem> | ||
| <FluentOverflowItem><FluentBadge Content="Office"></FluentBadge></FluentOverflowItem> | ||
| <FluentOverflowItem><FluentBadge Content="Installation"></FluentBadge></FluentOverflowItem> | ||
| <FluentOverflowItem><FluentBadge Content="Blazor"></FluentBadge></FluentOverflowItem> | ||
| <FluentOverflowItem><FluentBadge Content="Microsoft"></FluentBadge></FluentOverflowItem> | ||
| <FluentOverflowItem><FluentBadge Content="Azure"></FluentBadge></FluentOverflowItem> | ||
| <FluentOverflowItem><FluentBadge Content="DevOps"></FluentBadge></FluentOverflowItem> | ||
| <FluentOverflowItem><FluentBadge Content="Framework"></FluentBadge></FluentOverflowItem> | ||
| <FluentOverflowItem><FluentBadge Content="Office"></FluentBadge></FluentOverflowItem> | ||
| <FluentOverflowItem><FluentBadge Content="Installation"></FluentBadge></FluentOverflowItem> | ||
| <FluentBadge Content="Blazor"></FluentBadge> | ||
| <FluentBadge Content="Microsoft"></FluentBadge> | ||
| <FluentBadge Content="Azure"></FluentBadge> | ||
| <FluentBadge Content="DevOps"></FluentBadge> | ||
| <FluentBadge Content="Framework"></FluentBadge> | ||
| <FluentBadge Content="Office"></FluentBadge> | ||
| <FluentBadge Content="Installation"></FluentBadge> | ||
| <FluentBadge Content="Blazor"></FluentBadge> | ||
| <FluentBadge Content="Microsoft"></FluentBadge> | ||
| <FluentBadge Content="Azure"></FluentBadge> | ||
| <FluentBadge Content="DevOps"></FluentBadge> | ||
| <FluentBadge Content="Framework"></FluentBadge> | ||
| <FluentBadge Content="Office"></FluentBadge> | ||
| <FluentBadge Content="Installation"></FluentBadge> | ||
| </FluentOverflow> | ||
| </div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
...entUI.Demo.Client/Documentation/GetStarted/Migration/MigrationFluentOverflow.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| --- | ||
| title: Migration FluentOverflow | ||
| route: /Migration/Overflow | ||
| hidden: true | ||
| --- | ||
|
|
||
| ## Web component migration | ||
|
|
||
| `FluentOverflow` now wraps a `<fluent-overflow>` web component. Overflow calculation | ||
| and resize are handled there, with Blazor receiving overflow state updates. | ||
|
|
||
| ## Content model changes | ||
|
|
||
| - The old dedicated overflow item component is removed. | ||
| - Overflow now works with direct children of `FluentOverflow`. | ||
| - Per-item behavior is expressed with HTML attributes on the child element (for example `fixed="fixed"` or `fixed="ellipsis"`). | ||
|
|
||
| ## New/updated parameters | ||
|
|
||
| - `Selector` β CSS selector for direct children to include in overflow handling. | ||
| - `MaxRenderedItems` (`int`, default `25`) β limits the number of overflow items returned in the payload (`<= 0` means unlimited). | ||
| - `StoreOverflowInMemory` (`bool`) β keeps overflow payload items in JavaScript memory. | ||
|
|
||
| ## Removed APIs | ||
|
|
||
| - `FluentOverflowItem` component β removed; use direct child content instead. | ||
| - `OverflowItemFixed` enum β removed; use the child `fixed` attribute values instead. | ||
|
|
||
| ## Migration example | ||
|
|
||
| ```xml | ||
| <!-- V4 --> | ||
| <FluentOverflow> | ||
| <FluentOverflowItem Text="Pinned" Fixed="OverflowItemFixed.Fixed" /> | ||
| <FluentOverflowItem Text="Blazor" /> | ||
| <FluentOverflowItem Text="Microsoft" /> | ||
| </FluentOverflow> | ||
|
|
||
| <!-- V5 --> | ||
| <FluentOverflow> | ||
| <div fixed="fixed">Pinned</div> | ||
| <div>Blazor</div> | ||
| <div>Microsoft</div> | ||
| </FluentOverflow> | ||
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like the syntax
fixed=fixed:-)Copilot suggests the following:
<div pinned="static">...</div>or<div pinned>...</div><div pinned="ellipsis">...</div>