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

fix(module: overlay): positioning moved to js #1848

Merged
merged 32 commits into from
Sep 10, 2021

Conversation

anddrzejb
Copy link
Member

@anddrzejb anddrzejb commented Aug 17, 2021

🤔 This is a ...

  • New feature
  • Bug fix
  • Site / documentation update
  • Demo update
  • Component style update
  • Bundle size optimization
  • Performance optimization
  • Refactoring
  • Code style optimization
  • Test Case
  • Branch merge
  • Other (about what?)

🔗 Related issue link

Fixes #1557
Fixes #1836
Fixes #1880
Fixes #1672
Fixes #1613
Fixes #1388
Fixes #1075
Fixes #1565
Fixes #1414
Fixes #886
Fixes #1928

💡 Background and solution

The goal of this PR is to improve performance for ServerSide without affecting Wasm. Major change has happened in the Overlay. All code that was responsible for overlay positioning, size change detection & scroll has been removed. Instead, a new class Overlay has been created in the file overlay.ts. That class handles:

  • calculation of the position
  • recalculation on container size change (uses ResizeObserver)
  • recalculation on trigger mutation: either size or position (by monitoring style attribute, uses MutationObserver) - direct example is shown in the slider demo, when tooltip has to "follow" the slider's edge (it should be much more performant now)
  • recalculation on scroll - for now any scroll causes recalculation, but this could be optimized to actually detect if recalculation is needed
    The calculation logic has been changed. Originally, all calculations were done from the perspective of top and left coordinates. The Overlay now is using all coordinates for its position calculation (no all at once, but depending on the selected placement, a pair is selected, ex: top & right, bottom & left, top&left`, etc). This addresses the changes proposed by @anranruye in PR fix(module:overlay): use right positioning for bottom-right placement #1799 (I also remebered about fix(module:overlay): fix overlay position when container element has border #1797).

The logic of the new calculation is also explained in this miro diagram(title "overlay calculation logic") - you may need to zoom-out.
A big challenge for me was also to include typescript tests with dom support, mocking & theories. This can serve as an example as well for future contributors on how ts tests might be done. I am sure the tests could be optimized, but I decided to leave them as such - maybe this simpler approach will be more understandable to someone who just wants to start with tests.

There are 2 breaking changes - I switched from PlacementType (class) to Placement enum in [Parameter] usage, while still using the PlacementType class and its logic. I also switched the TriggerType class to Trigger enum in [Parameter] usage. There are 2 reasons for changes:

  1. According to Performance best practices #992, for performance purposes we should use primitive types to avoid unnecessary rendering of component subtrees
  2. It is easier to move an enum between C# and JS. This is however a breaking change that will affect a lot of people.

What is missing:

  • currently the adjustment strategy is the same as previously - if overlay does not fit, switch sides; the difference is that the sides are switched independently of a direction; what possibly is missing is to attempt to fit the overlay by disconnecting it from the trigger (in a way that it can even obstruct the trigger)
  • more adjustment scenarios - when simple switching sides is not working, continue with all other possible placements
  • scroll optimization - run only when it is needed; a sample is done in the ts file (commented out code in onScroll function)
  • for RangePicker there probably should be more functionality available that handles situation (for example on a mobile device) when RangePicker just does not fit (width is larger than device screen width);

Testing experience - I found that Visual Studio Code is actually best to develop & test typescript. The test runner there actually picks up the tests and they can be run individually (and most important, debugged - no need to deal with god-awful debugging in browsers). It even picks up separate theory scenarios:
image
However Visual Studio Code does not come with all the goodies to run the tests. Maybe it would be beneficial to create a wiki entry on how to configure dev env for ts tests.

Other stuff:

  1. Overlay & OverlayTrigger were optimized to reduce number of rerenderings
  2. MenuItem had been changed not to render Tooltip every time but only on a compact & root menu (previously it was always rendering it)
  3. Select, DatePicker & RangePicker have now available [Parameter] BoundaryAdjustmentMode

📝 Changelog

Language Changelog
🇺🇸 English TriggerType switched to AntDesign.Trigger enum. PlacementType switched to AntDesign.Placement enum. Autocomplete, Cascader, PaginationOptions, Select, DatePicker & RangePicker have now available [Parameter] BoundaryAdjustmentMode
🇨🇳 Chinese

☑️ Self Check before Merge

⚠️ Please check all items below before review. ⚠️

  • Doc is updated/provided or not needed
  • Demo is updated/provided or not needed
  • Changelog is provided or not needed

@github-actions
Copy link

github-actions bot commented Aug 17, 2021

@anddrzejb anddrzejb changed the title fix(module: overlay): positioning to moved to js fix(module: overlay): positioning moved to js Aug 17, 2021
@ElderJames
Copy link
Member

Awesome @anddrzejb ! It helps a lot!

optimization & cleanup
@anddrzejb
Copy link
Member Author

@ElderJames I forgot to mention in the PR comment: I checked with the same VPN setup as described in #1557 this comment. The execution time dropped to 273ms in comparison to 39ms locally. So that is significant improvement to previous 1.65sec (which was already optimized by my other attempts) and around 3-4 sec on the unaltered version.

@codecov
Copy link

codecov bot commented Aug 17, 2021

Codecov Report

Merging #1848 (d6b9f07) into master (de2e668) will increase coverage by 2.18%.
The diff coverage is 56.04%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1848      +/-   ##
==========================================
+ Coverage   23.36%   25.54%   +2.18%     
==========================================
  Files         483      507      +24     
  Lines       31484    23994    -7490     
  Branches        0      229     +229     
==========================================
- Hits         7355     6129    -1226     
+ Misses      24129    17829    -6300     
- Partials        0       36      +36     
Impacted Files Coverage Δ
components/auto-complete/AutoComplete.razor 0.00% <ø> (ø)
components/auto-complete/AutoComplete.razor.cs 0.00% <0.00%> (ø)
components/avatar/AvatarGroup.razor 0.00% <ø> (ø)
components/avatar/AvatarGroup.razor.cs 0.00% <0.00%> (ø)
components/breadcrumb/BreadcrumbItem.razor 0.00% <ø> (ø)
components/cascader/Cascader.razor 83.22% <ø> (+9.30%) ⬆️
components/core/Component/Overlay/Overlay.razor 85.71% <ø> (+28.57%) ⬆️
...onents/core/Component/Overlay/OverlayTrigger.razor 80.00% <ø> (+13.33%) ⬆️
...re/JsInterop/ObservableApi/intersectionObserver.ts 0.00% <0.00%> (ø)
...ents/core/JsInterop/ObservableApi/observableApi.ts 100.00% <ø> (ø)
... and 457 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update de2e668...d6b9f07. Read the comment docs.

@ElderJames
Copy link
Member

That's great improvement!

Is there any chance that those adjustment strategies will be added?

currently the adjustment strategy is the same as previously - if overlay does not fit, switch sides; the difference is that the sides are switched independently of a direction; what possibly is missing is to attempt to fit the overlay by disconnecting it from the trigger (in a way that it can even obstruct the trigger)
more adjustment scenarios - when simple switching sides is not working, continue with all other possible placements
scroll optimization - run only when it is needed; a sample is done in the ts file (commented out code in onScroll function)
for RangePicker there probably should be more functionality available that handles situation (for example on a mobile device) when RangePicker just does not fit (width is larger than device screen width);

@anddrzejb
Copy link
Member Author

That's great improvement!

Is there any chance that those adjustment strategies will be added?

A chance exists, but we need to discuss which strategies should be used and in what order. And maybe we could be smart about it and not just try every possible scenaio. Also, some components should not apply disconnect scenarios (for example tooltip). I will try to prepare some kind of description of what I foresee as a problem and maybe we could discuss what is the preferred solution. Do you want to make these solution part of this PR?

@ElderJames
Copy link
Member

@anddrzejb Of course not, you can bring them to another PR.

I think we could refer other libraries, such as:

@anddrzejb
Copy link
Member Author

anddrzejb commented Aug 18, 2021

I am on a leave now, but I will think about the improvements.
I did have a look at popper before. I liked it approach to scrolling behavior when the arrow is involved, but I am not sure if this is what we want. It seems to me that we already surpass the react antD when it comes to overlay behaviour on boundaries detection. And I have other performance improvements on my mind that I think should be addressed before any other new visual features. I know the performance changes are not as flashy as visual and really hard to advertise, but nevertheless still very needed.

@ElderJames
Copy link
Member

Totally agree.
Let's review this PR first and I hope to merge it this weekend if it goes well。

@ElderJames
Copy link
Member

I think it also needs to follow the resize of the trigger to adjust the positioning.

select-dropdown

@anddrzejb
Copy link
Member Author

anddrzejb commented Aug 22, 2021

I think it also needs to follow the resize of the trigger to adjust the positioning.

@ElderJames you are absolutely right. Somehow I missed that. Please check my commit 0cecc3c. It was really easy with ResizeObserver.

@ElderJames
Copy link
Member

The dropdown of submenu will be repeatedly opened in some cases

menu-dropdown

@anddrzejb
Copy link
Member Author

The dropdown of submenu will be repeatedly opened in some cases

I think this is not repeatedly shown, but sometimes overlay stays open instead of closing. I just tried to recreate it and failed. This is a bug that is coming from original implementation. Overlay hiding is triggered either by JS call or by overlay trigger (as far as I remember) and I did not change that. I already noticed that when there is a lot of things happening, some js events seem to be lost - I guess this may happen, since js is only single threaded. I don't know - maybe a web worker could solve us this problem? This is something I never worked with (there is always a first time though...). What do you think?

@anddrzejb
Copy link
Member Author

The dropdown of submenu will be repeatedly opened in some cases

So I had a closer look and indeed I can see that this problem is coming from trigger event onMouseLeave. Actually, js event fires properly. The problem happens in the Overlay. I believe the underlaying problem is indeed single threaded nature of js. Anyway, the issue is that sometimes the Show method of the Overlay does not manage to finish (it has few awaits inside of it and the js itself can sometimes take a bit of time to execute) when the onMouseLeave event triggers Hide method of the Overlay. During Hide method, a check is done if _isOverlayShow == true. The problem is that sometimes it is still false because Show method hasn't finished processing and did not set it to true. The code to handle this scenario is basically a loop (up to 100 times) that waits for _isOverlayShow to become true. I probably would prefer using a while loop, but I am afraid there is something I overlooked and we will end up with an endless one. Please have a look at the gif and the code snippets I used during the gif generation. I added this piece of code in the begining of Show method:

        internal async Task Show(int? overlayLeft = null, int? overlayTop = null)
        {
            Console.WriteLine($"Showing {Trigger.Id}");
...

and this code in the beginning of Hide:

        internal async Task Hide(bool force = false)
        {
            Console.WriteLine($"Hiding {Trigger.Id}");
            if (_isOverlayDuringShowing)
            {
                for (int i = 0; i < 100; i++)
                {
                    Console.WriteLine($"Hiding {Trigger.Id}: waiting {i+1} time...");
                    await Task.Delay(10);
                    if (_isOverlayShow)
                    {
                        break;
                    }
                }
            }
            if (!_isOverlayShow)
            {
                Console.WriteLine($"Hiding {Trigger.Id}: stopped due to _isOverlayShow: {_isOverlayShow}");
                return;
            }
...

And the result:
overlayMouseLeave

As you can see on the gif, sometimes the loop repeats up to 16 times. In my other tests, I had it up to 26 times. 100 times x 10ms gives a moderate 1 second wait time. At this point I am waiting for suggestions.

I applied the above changes to commit 708797a.

@anddrzejb
Copy link
Member Author

anddrzejb commented Aug 24, 2021

Commit 670c829 is extracting the for loop into a WaitFor function (the loop I described in my previous comment). I found out that in case of Slider with visible tooltip on the ServerSide the same wait is needed - I guess because of the overlay is being rendered before trigger gets back the element reference. Without the wait, overlay throws an exception, because Trigger.Ref.Id is null.

@anddrzejb
Copy link
Member Author

@ElderJames no worries, I was waiting for that PR to be merged. Now I need to figure out how it works, so I can apply it properly 😄 but I think it is a great improvement. Kudos to @tonyyip1969!

Copy link
Member

@ElderJames ElderJames left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @anddrzejb ! This is a huge improvement!

@ElderJames ElderJames merged commit d654382 into ant-design-blazor:master Sep 10, 2021
@anddrzejb
Copy link
Member Author

@ElderJames I am very happy it was approved. Now I will be waiting for devs complaints about breaking changes 😨

@anddrzejb anddrzejb deleted the overlayPositioningToJs branch September 10, 2021 13:26
ElderJames added a commit that referenced this pull request Sep 14, 2021
* fix(module: form): remove `FormItem` from `Form` when it was disposed (#1901)

* pref(module: table): put fixed column style into js (#1897)

* pref(module: table): put fixed column style into js

* fix resize listener

* docs: Add building demo assets to the Readme (#1904)

* feat(module: table): add `CellData` for `CellRender` (#1907)

* docs: add dynamic table demo (#1908)

* feat(module: table): add dynamic data demo

* add scroll x

* fix(module: select): value no longer reset on datasource set (#1906)

* fix(module:select): value no longer reset on datasource set

* fix(module:select): dataSource change detection

* fix: improve datasource detection
add item & set value in SelectOption

* tests: scenario from issue #1207

* fix: DataSourceEqualityComparer default

* docs: Fixed typo (#1915)

* fix(module: input): Add stop propagation (#1917)

* docs(module: select): update coordinate demo (#1914)

Co-authored-by: James Yeung <shunjiey@hotmail.com>

* fix(module: textarea): add rows parameter (#1920)

doc: adjust to match antD
tests: sizing tests

* test(module: select): Add some unit tests for Select (#1891)

* Add Select clear tests

* Add Select DataSource to null test

* Change the implement of Throw tests

* Change int to int?

* fix(module: button): loading icon styles (#1902)

* Fix loading icon styles

* Fix button render test

* feat(module: InputNumber): Add inputmode for mobile keyboard (#1923)

* perf: avoid memory leak issue of event listener (#1857)

* perf: avoid memory leak #1834

Avoid memory leak by remove the exclusive parameter and logic in the code block on AddEventListener method in DomEventService class.

The following are the components affected:
components/affix/Affix.razor.cs
components/anchor/Anchor.razor.cs
components/carousel/Carousel.razor.cs
components/core/Component/Overlay/Overlay.razor.cs
components/core/Component/Overlay/OverlayTrigger.razor.cs
components/core/JsInterop/DomEventService.cs
components/descriptions/Descriptions.razor.cs
components/dropdown/DropdownButton.cs
components/grid/Row.razor.cs
components/input/Input.cs
components/input/TextArea.razor.cs
components/layout/Sider.razor.cs
components/list/ListItem.razor.cs
components/select/Select.razor.cs
components/select/internal/SelectContent.razor.cs
components/slider/Slider.razor.cs
components/table/Table.razor.cs
components/tabs/Tabs.razor.cs

* fix override AddEventListener method in AntDesign.TestKit project

* add register/remove event listerner for exclusive use in DomEventService class

* move _dotNetObjects to DomEventListerner class/service, so that users not required to maintain it in each component.

* * move share/reuse dom event listerner methods to DomEventListerner class

* remove method 'AddEventListener' that no longer exists in DomEventService class in AntDesign.TestKit project

* * change the component referring to an IDomEventListerner interface instead of a concrete class,
  so that the component can be tested via a mock TestDomEventListerner.

* introduce DisposeShared and Dispose method in DomEventListerner to ease user remove callback from DomEventListerner

* register IDomEventListerner into DI container instead of create manually

* fix FormatKey

* fix FormatKey

* fix tests

* fix test

* fix test

Co-authored-by: James Yeung <shunjiey@hotmail.com>

* fix(module: textarea): replace wrong event (#1927)

* tests(module: textarea): include js function mock to avoid bunit exceptions (#1930)

* perf(module: overlay): positioning moved to js (#1848)

* fix(module:overlay): move postion calculation to js

fixes #1836

* docs: TriggerBoundaryAdjustMode explanation

* docs: select & datepicker got BoundaryAdjustmetMode

cleanup

* test: fixes

optimization & cleanup

* fix(module:overlay): recalculate overlay position when trigger resizes

* Minor clean-up

* fix(module:overlay): wait for Show to finish in Hide

* fix: prevent vertical scrollbar on overlay adding

* fix: extract waiting function

* fix: overlay not to repostion when trigger vanishes (menu issue)

* fix: scroll adjustment for position: fixed

* fix: on menu mode change, keep

* merge conflict fix

* fix: nominal calculation reset on failed adjustment

* fix: bugs

* test: exclude log method from test coverage in overlay.ts

* fix(module: table): It would be load twice at first time if pagesize is not 10 (#1933)

* fix(module: menu): collapsed menu title can't hide while use router link (#1934)

* fix(module: select): fix data source of type IEnumerable<object> (#1932)

* fix(module:select): fix data source of type IEnumerable<object>

* Update Select.razor.cs

* Update Select.OnDataSourceChangeTests.razor

Co-authored-by: James Yeung <shunjiey@hotmail.com>

* feat(module: InputNumber): Add OnFocus event (#1931)

* Add on textbox focus

* Adjust naming

Co-authored-by: James Yeung <shunjiey@hotmail.com>

* fix(module: list): resposive style doesn't work (#1937)

* docs: Update index.zh-CN.md (#1936)

Update document ConfigProvider global configuration example code

Co-authored-by: James Yeung <shunjiey@hotmail.com>

* change log 0.9.4 (#1938)

* chore: test cs project to include test runner adapter (#1939)

test: add general overlay disposal method mock

Co-authored-by: Alan.Liu <lxyruanjian@126.com>
Co-authored-by: James Yeung <shunjiey@hotmail.com>
Co-authored-by: rabberbock <rabberbock@gmail.com>
Co-authored-by: Andrzej Bakun <anddrzejb@poczta.fm>
Co-authored-by: Chandan Rauniyar <chandankkrr@gmail.com>
Co-authored-by: Luke Parker [SSW] <10430890+Hona@users.noreply.github.com>
Co-authored-by: SmallY <45689960+iamSmallY@users.noreply.github.com>
Co-authored-by: Maksim <maksalmak@gmail.com>
Co-authored-by: Tony Yip <tonyyip1969@gmail.com>
Co-authored-by: SmRiley <45205313+SmRiley@users.noreply.github.com>
ElderJames pushed a commit that referenced this pull request Apr 23, 2022
* fix(module:overlay): move postion calculation to js

fixes #1836

* docs: TriggerBoundaryAdjustMode explanation

* docs: select & datepicker got BoundaryAdjustmetMode

cleanup

* test: fixes

optimization & cleanup

* fix(module:overlay): recalculate overlay position when trigger resizes

* Minor clean-up

* fix(module:overlay): wait for Show to finish in Hide

* fix: prevent vertical scrollbar on overlay adding

* fix: extract waiting function

* fix: overlay not to repostion when trigger vanishes (menu issue)

* fix: scroll adjustment for position: fixed

* fix: on menu mode change, keep

* merge conflict fix

* fix: nominal calculation reset on failed adjustment

* fix: bugs

* test: exclude log method from test coverage in overlay.ts
ElderJames added a commit that referenced this pull request Apr 23, 2022
* fix(module: form): remove `FormItem` from `Form` when it was disposed (#1901)

* pref(module: table): put fixed column style into js (#1897)

* pref(module: table): put fixed column style into js

* fix resize listener

* docs: Add building demo assets to the Readme (#1904)

* feat(module: table): add `CellData` for `CellRender` (#1907)

* docs: add dynamic table demo (#1908)

* feat(module: table): add dynamic data demo

* add scroll x

* fix(module: select): value no longer reset on datasource set (#1906)

* fix(module:select): value no longer reset on datasource set

* fix(module:select): dataSource change detection

* fix: improve datasource detection
add item & set value in SelectOption

* tests: scenario from issue #1207

* fix: DataSourceEqualityComparer default

* docs: Fixed typo (#1915)

* fix(module: input): Add stop propagation (#1917)

* docs(module: select): update coordinate demo (#1914)

Co-authored-by: James Yeung <shunjiey@hotmail.com>

* fix(module: textarea): add rows parameter (#1920)

doc: adjust to match antD
tests: sizing tests

* test(module: select): Add some unit tests for Select (#1891)

* Add Select clear tests

* Add Select DataSource to null test

* Change the implement of Throw tests

* Change int to int?

* fix(module: button): loading icon styles (#1902)

* Fix loading icon styles

* Fix button render test

* feat(module: InputNumber): Add inputmode for mobile keyboard (#1923)

* perf: avoid memory leak issue of event listener (#1857)

* perf: avoid memory leak #1834

Avoid memory leak by remove the exclusive parameter and logic in the code block on AddEventListener method in DomEventService class.

The following are the components affected:
components/affix/Affix.razor.cs
components/anchor/Anchor.razor.cs
components/carousel/Carousel.razor.cs
components/core/Component/Overlay/Overlay.razor.cs
components/core/Component/Overlay/OverlayTrigger.razor.cs
components/core/JsInterop/DomEventService.cs
components/descriptions/Descriptions.razor.cs
components/dropdown/DropdownButton.cs
components/grid/Row.razor.cs
components/input/Input.cs
components/input/TextArea.razor.cs
components/layout/Sider.razor.cs
components/list/ListItem.razor.cs
components/select/Select.razor.cs
components/select/internal/SelectContent.razor.cs
components/slider/Slider.razor.cs
components/table/Table.razor.cs
components/tabs/Tabs.razor.cs

* fix override AddEventListener method in AntDesign.TestKit project

* add register/remove event listerner for exclusive use in DomEventService class

* move _dotNetObjects to DomEventListerner class/service, so that users not required to maintain it in each component.

* * move share/reuse dom event listerner methods to DomEventListerner class

* remove method 'AddEventListener' that no longer exists in DomEventService class in AntDesign.TestKit project

* * change the component referring to an IDomEventListerner interface instead of a concrete class,
  so that the component can be tested via a mock TestDomEventListerner.

* introduce DisposeShared and Dispose method in DomEventListerner to ease user remove callback from DomEventListerner

* register IDomEventListerner into DI container instead of create manually

* fix FormatKey

* fix FormatKey

* fix tests

* fix test

* fix test

Co-authored-by: James Yeung <shunjiey@hotmail.com>

* fix(module: textarea): replace wrong event (#1927)

* tests(module: textarea): include js function mock to avoid bunit exceptions (#1930)

* perf(module: overlay): positioning moved to js (#1848)

* fix(module:overlay): move postion calculation to js

fixes #1836

* docs: TriggerBoundaryAdjustMode explanation

* docs: select & datepicker got BoundaryAdjustmetMode

cleanup

* test: fixes

optimization & cleanup

* fix(module:overlay): recalculate overlay position when trigger resizes

* Minor clean-up

* fix(module:overlay): wait for Show to finish in Hide

* fix: prevent vertical scrollbar on overlay adding

* fix: extract waiting function

* fix: overlay not to repostion when trigger vanishes (menu issue)

* fix: scroll adjustment for position: fixed

* fix: on menu mode change, keep

* merge conflict fix

* fix: nominal calculation reset on failed adjustment

* fix: bugs

* test: exclude log method from test coverage in overlay.ts

* fix(module: table): It would be load twice at first time if pagesize is not 10 (#1933)

* fix(module: menu): collapsed menu title can't hide while use router link (#1934)

* fix(module: select): fix data source of type IEnumerable<object> (#1932)

* fix(module:select): fix data source of type IEnumerable<object>

* Update Select.razor.cs

* Update Select.OnDataSourceChangeTests.razor

Co-authored-by: James Yeung <shunjiey@hotmail.com>

* feat(module: InputNumber): Add OnFocus event (#1931)

* Add on textbox focus

* Adjust naming

Co-authored-by: James Yeung <shunjiey@hotmail.com>

* fix(module: list): resposive style doesn't work (#1937)

* docs: Update index.zh-CN.md (#1936)

Update document ConfigProvider global configuration example code

Co-authored-by: James Yeung <shunjiey@hotmail.com>

* change log 0.9.4 (#1938)

* chore: test cs project to include test runner adapter (#1939)

test: add general overlay disposal method mock

Co-authored-by: Alan.Liu <lxyruanjian@126.com>
Co-authored-by: James Yeung <shunjiey@hotmail.com>
Co-authored-by: rabberbock <rabberbock@gmail.com>
Co-authored-by: Andrzej Bakun <anddrzejb@poczta.fm>
Co-authored-by: Chandan Rauniyar <chandankkrr@gmail.com>
Co-authored-by: Luke Parker [SSW] <10430890+Hona@users.noreply.github.com>
Co-authored-by: SmallY <45689960+iamSmallY@users.noreply.github.com>
Co-authored-by: Maksim <maksalmak@gmail.com>
Co-authored-by: Tony Yip <tonyyip1969@gmail.com>
Co-authored-by: SmRiley <45205313+SmRiley@users.noreply.github.com>
ElderJames pushed a commit that referenced this pull request Apr 30, 2022
* fix(module:overlay): move postion calculation to js

fixes #1836

* docs: TriggerBoundaryAdjustMode explanation

* docs: select & datepicker got BoundaryAdjustmetMode

cleanup

* test: fixes

optimization & cleanup

* fix(module:overlay): recalculate overlay position when trigger resizes

* Minor clean-up

* fix(module:overlay): wait for Show to finish in Hide

* fix: prevent vertical scrollbar on overlay adding

* fix: extract waiting function

* fix: overlay not to repostion when trigger vanishes (menu issue)

* fix: scroll adjustment for position: fixed

* fix: on menu mode change, keep

* merge conflict fix

* fix: nominal calculation reset on failed adjustment

* fix: bugs

* test: exclude log method from test coverage in overlay.ts
ElderJames added a commit that referenced this pull request Apr 30, 2022
* fix(module: form): remove `FormItem` from `Form` when it was disposed (#1901)

* pref(module: table): put fixed column style into js (#1897)

* pref(module: table): put fixed column style into js

* fix resize listener

* docs: Add building demo assets to the Readme (#1904)

* feat(module: table): add `CellData` for `CellRender` (#1907)

* docs: add dynamic table demo (#1908)

* feat(module: table): add dynamic data demo

* add scroll x

* fix(module: select): value no longer reset on datasource set (#1906)

* fix(module:select): value no longer reset on datasource set

* fix(module:select): dataSource change detection

* fix: improve datasource detection
add item & set value in SelectOption

* tests: scenario from issue #1207

* fix: DataSourceEqualityComparer default

* docs: Fixed typo (#1915)

* fix(module: input): Add stop propagation (#1917)

* docs(module: select): update coordinate demo (#1914)

Co-authored-by: James Yeung <shunjiey@hotmail.com>

* fix(module: textarea): add rows parameter (#1920)

doc: adjust to match antD
tests: sizing tests

* test(module: select): Add some unit tests for Select (#1891)

* Add Select clear tests

* Add Select DataSource to null test

* Change the implement of Throw tests

* Change int to int?

* fix(module: button): loading icon styles (#1902)

* Fix loading icon styles

* Fix button render test

* feat(module: InputNumber): Add inputmode for mobile keyboard (#1923)

* perf: avoid memory leak issue of event listener (#1857)

* perf: avoid memory leak #1834

Avoid memory leak by remove the exclusive parameter and logic in the code block on AddEventListener method in DomEventService class.

The following are the components affected:
components/affix/Affix.razor.cs
components/anchor/Anchor.razor.cs
components/carousel/Carousel.razor.cs
components/core/Component/Overlay/Overlay.razor.cs
components/core/Component/Overlay/OverlayTrigger.razor.cs
components/core/JsInterop/DomEventService.cs
components/descriptions/Descriptions.razor.cs
components/dropdown/DropdownButton.cs
components/grid/Row.razor.cs
components/input/Input.cs
components/input/TextArea.razor.cs
components/layout/Sider.razor.cs
components/list/ListItem.razor.cs
components/select/Select.razor.cs
components/select/internal/SelectContent.razor.cs
components/slider/Slider.razor.cs
components/table/Table.razor.cs
components/tabs/Tabs.razor.cs

* fix override AddEventListener method in AntDesign.TestKit project

* add register/remove event listerner for exclusive use in DomEventService class

* move _dotNetObjects to DomEventListerner class/service, so that users not required to maintain it in each component.

* * move share/reuse dom event listerner methods to DomEventListerner class

* remove method 'AddEventListener' that no longer exists in DomEventService class in AntDesign.TestKit project

* * change the component referring to an IDomEventListerner interface instead of a concrete class,
  so that the component can be tested via a mock TestDomEventListerner.

* introduce DisposeShared and Dispose method in DomEventListerner to ease user remove callback from DomEventListerner

* register IDomEventListerner into DI container instead of create manually

* fix FormatKey

* fix FormatKey

* fix tests

* fix test

* fix test

Co-authored-by: James Yeung <shunjiey@hotmail.com>

* fix(module: textarea): replace wrong event (#1927)

* tests(module: textarea): include js function mock to avoid bunit exceptions (#1930)

* perf(module: overlay): positioning moved to js (#1848)

* fix(module:overlay): move postion calculation to js

fixes #1836

* docs: TriggerBoundaryAdjustMode explanation

* docs: select & datepicker got BoundaryAdjustmetMode

cleanup

* test: fixes

optimization & cleanup

* fix(module:overlay): recalculate overlay position when trigger resizes

* Minor clean-up

* fix(module:overlay): wait for Show to finish in Hide

* fix: prevent vertical scrollbar on overlay adding

* fix: extract waiting function

* fix: overlay not to repostion when trigger vanishes (menu issue)

* fix: scroll adjustment for position: fixed

* fix: on menu mode change, keep

* merge conflict fix

* fix: nominal calculation reset on failed adjustment

* fix: bugs

* test: exclude log method from test coverage in overlay.ts

* fix(module: table): It would be load twice at first time if pagesize is not 10 (#1933)

* fix(module: menu): collapsed menu title can't hide while use router link (#1934)

* fix(module: select): fix data source of type IEnumerable<object> (#1932)

* fix(module:select): fix data source of type IEnumerable<object>

* Update Select.razor.cs

* Update Select.OnDataSourceChangeTests.razor

Co-authored-by: James Yeung <shunjiey@hotmail.com>

* feat(module: InputNumber): Add OnFocus event (#1931)

* Add on textbox focus

* Adjust naming

Co-authored-by: James Yeung <shunjiey@hotmail.com>

* fix(module: list): resposive style doesn't work (#1937)

* docs: Update index.zh-CN.md (#1936)

Update document ConfigProvider global configuration example code

Co-authored-by: James Yeung <shunjiey@hotmail.com>

* change log 0.9.4 (#1938)

* chore: test cs project to include test runner adapter (#1939)

test: add general overlay disposal method mock

Co-authored-by: Alan.Liu <lxyruanjian@126.com>
Co-authored-by: James Yeung <shunjiey@hotmail.com>
Co-authored-by: rabberbock <rabberbock@gmail.com>
Co-authored-by: Andrzej Bakun <anddrzejb@poczta.fm>
Co-authored-by: Chandan Rauniyar <chandankkrr@gmail.com>
Co-authored-by: Luke Parker [SSW] <10430890+Hona@users.noreply.github.com>
Co-authored-by: SmallY <45689960+iamSmallY@users.noreply.github.com>
Co-authored-by: Maksim <maksalmak@gmail.com>
Co-authored-by: Tony Yip <tonyyip1969@gmail.com>
Co-authored-by: SmRiley <45205313+SmRiley@users.noreply.github.com>
ElderJames pushed a commit that referenced this pull request Sep 6, 2022
* fix(module:overlay): move postion calculation to js

fixes #1836

* docs: TriggerBoundaryAdjustMode explanation

* docs: select & datepicker got BoundaryAdjustmetMode

cleanup

* test: fixes

optimization & cleanup

* fix(module:overlay): recalculate overlay position when trigger resizes

* Minor clean-up

* fix(module:overlay): wait for Show to finish in Hide

* fix: prevent vertical scrollbar on overlay adding

* fix: extract waiting function

* fix: overlay not to repostion when trigger vanishes (menu issue)

* fix: scroll adjustment for position: fixed

* fix: on menu mode change, keep

* merge conflict fix

* fix: nominal calculation reset on failed adjustment

* fix: bugs

* test: exclude log method from test coverage in overlay.ts
ElderJames added a commit that referenced this pull request Sep 6, 2022
* fix(module: form): remove `FormItem` from `Form` when it was disposed (#1901)

* pref(module: table): put fixed column style into js (#1897)

* pref(module: table): put fixed column style into js

* fix resize listener

* docs: Add building demo assets to the Readme (#1904)

* feat(module: table): add `CellData` for `CellRender` (#1907)

* docs: add dynamic table demo (#1908)

* feat(module: table): add dynamic data demo

* add scroll x

* fix(module: select): value no longer reset on datasource set (#1906)

* fix(module:select): value no longer reset on datasource set

* fix(module:select): dataSource change detection

* fix: improve datasource detection
add item & set value in SelectOption

* tests: scenario from issue #1207

* fix: DataSourceEqualityComparer default

* docs: Fixed typo (#1915)

* fix(module: input): Add stop propagation (#1917)

* docs(module: select): update coordinate demo (#1914)

Co-authored-by: James Yeung <shunjiey@hotmail.com>

* fix(module: textarea): add rows parameter (#1920)

doc: adjust to match antD
tests: sizing tests

* test(module: select): Add some unit tests for Select (#1891)

* Add Select clear tests

* Add Select DataSource to null test

* Change the implement of Throw tests

* Change int to int?

* fix(module: button): loading icon styles (#1902)

* Fix loading icon styles

* Fix button render test

* feat(module: InputNumber): Add inputmode for mobile keyboard (#1923)

* perf: avoid memory leak issue of event listener (#1857)

* perf: avoid memory leak #1834

Avoid memory leak by remove the exclusive parameter and logic in the code block on AddEventListener method in DomEventService class.

The following are the components affected:
components/affix/Affix.razor.cs
components/anchor/Anchor.razor.cs
components/carousel/Carousel.razor.cs
components/core/Component/Overlay/Overlay.razor.cs
components/core/Component/Overlay/OverlayTrigger.razor.cs
components/core/JsInterop/DomEventService.cs
components/descriptions/Descriptions.razor.cs
components/dropdown/DropdownButton.cs
components/grid/Row.razor.cs
components/input/Input.cs
components/input/TextArea.razor.cs
components/layout/Sider.razor.cs
components/list/ListItem.razor.cs
components/select/Select.razor.cs
components/select/internal/SelectContent.razor.cs
components/slider/Slider.razor.cs
components/table/Table.razor.cs
components/tabs/Tabs.razor.cs

* fix override AddEventListener method in AntDesign.TestKit project

* add register/remove event listerner for exclusive use in DomEventService class

* move _dotNetObjects to DomEventListerner class/service, so that users not required to maintain it in each component.

* * move share/reuse dom event listerner methods to DomEventListerner class

* remove method 'AddEventListener' that no longer exists in DomEventService class in AntDesign.TestKit project

* * change the component referring to an IDomEventListerner interface instead of a concrete class,
  so that the component can be tested via a mock TestDomEventListerner.

* introduce DisposeShared and Dispose method in DomEventListerner to ease user remove callback from DomEventListerner

* register IDomEventListerner into DI container instead of create manually

* fix FormatKey

* fix FormatKey

* fix tests

* fix test

* fix test

Co-authored-by: James Yeung <shunjiey@hotmail.com>

* fix(module: textarea): replace wrong event (#1927)

* tests(module: textarea): include js function mock to avoid bunit exceptions (#1930)

* perf(module: overlay): positioning moved to js (#1848)

* fix(module:overlay): move postion calculation to js

fixes #1836

* docs: TriggerBoundaryAdjustMode explanation

* docs: select & datepicker got BoundaryAdjustmetMode

cleanup

* test: fixes

optimization & cleanup

* fix(module:overlay): recalculate overlay position when trigger resizes

* Minor clean-up

* fix(module:overlay): wait for Show to finish in Hide

* fix: prevent vertical scrollbar on overlay adding

* fix: extract waiting function

* fix: overlay not to repostion when trigger vanishes (menu issue)

* fix: scroll adjustment for position: fixed

* fix: on menu mode change, keep

* merge conflict fix

* fix: nominal calculation reset on failed adjustment

* fix: bugs

* test: exclude log method from test coverage in overlay.ts

* fix(module: table): It would be load twice at first time if pagesize is not 10 (#1933)

* fix(module: menu): collapsed menu title can't hide while use router link (#1934)

* fix(module: select): fix data source of type IEnumerable<object> (#1932)

* fix(module:select): fix data source of type IEnumerable<object>

* Update Select.razor.cs

* Update Select.OnDataSourceChangeTests.razor

Co-authored-by: James Yeung <shunjiey@hotmail.com>

* feat(module: InputNumber): Add OnFocus event (#1931)

* Add on textbox focus

* Adjust naming

Co-authored-by: James Yeung <shunjiey@hotmail.com>

* fix(module: list): resposive style doesn't work (#1937)

* docs: Update index.zh-CN.md (#1936)

Update document ConfigProvider global configuration example code

Co-authored-by: James Yeung <shunjiey@hotmail.com>

* change log 0.9.4 (#1938)

* chore: test cs project to include test runner adapter (#1939)

test: add general overlay disposal method mock

Co-authored-by: Alan.Liu <lxyruanjian@126.com>
Co-authored-by: James Yeung <shunjiey@hotmail.com>
Co-authored-by: rabberbock <rabberbock@gmail.com>
Co-authored-by: Andrzej Bakun <anddrzejb@poczta.fm>
Co-authored-by: Chandan Rauniyar <chandankkrr@gmail.com>
Co-authored-by: Luke Parker [SSW] <10430890+Hona@users.noreply.github.com>
Co-authored-by: SmallY <45689960+iamSmallY@users.noreply.github.com>
Co-authored-by: Maksim <maksalmak@gmail.com>
Co-authored-by: Tony Yip <tonyyip1969@gmail.com>
Co-authored-by: SmRiley <45205313+SmRiley@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment