-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
fix(module: overlay): positioning moved to js #1848
Conversation
Awesome @anddrzejb ! It helps a lot! |
optimization & cleanup
@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 Report
@@ 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
Continue to review full report at Codecov.
|
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? |
@anddrzejb Of course not, you can bring them to another PR. I think we could refer other libraries, such as: |
I am on a leave now, but I will think about the improvements. |
Totally agree. |
@ElderJames you are absolutely right. Somehow I missed that. Please check my commit 0cecc3c. It was really easy with |
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. |
So I had a closer look and indeed I can see that this problem is coming from trigger event internal async Task Show(int? overlayLeft = null, int? overlayTop = null)
{
Console.WriteLine($"Showing {Trigger.Id}");
... and this code in the beginning of 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;
}
... 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. |
Commit 670c829 is extracting the |
@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! |
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.
Thank you @anddrzejb ! This is a huge improvement!
@ElderJames I am very happy it was approved. Now I will be waiting for devs complaints about breaking changes 😨 |
* 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>
* 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: 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>
* 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: 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>
* 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: 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>
🤔 This is a ...
🔗 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 classOverlay
has been created in the fileoverlay.ts
. That class handles:ResizeObserver
)style
attribute, usesMutationObserver
) - direct example is shown in the slider demo, when tooltip has to "follow" the slider's edge (it should be much more performant now)The calculation logic has been changed. Originally, all calculations were done from the perspective of
top
andleft
coordinates. TheOverlay
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) toPlacement
enum in[Parameter]
usage, while still using thePlacementType
class and its logic. I also switched theTriggerType
class toTrigger
enum in[Parameter]
usage. There are 2 reasons for changes:What is missing:
onScroll
function)RangePicker
there probably should be more functionality available that handles situation (for example on a mobile device) whenRangePicker
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:
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:
Overlay
&OverlayTrigger
were optimized to reduce number of rerenderingsMenuItem
had been changed not to renderTooltip
every time but only on a compact & root menu (previously it was always rendering it)Select
,DatePicker
&RangePicker
have now available[Parameter] BoundaryAdjustmentMode
📝 Changelog
TriggerType
switched toAntDesign.Trigger
enum.PlacementType
switched toAntDesign.Placement
enum.Autocomplete
,Cascader
,PaginationOptions
,Select
,DatePicker
&RangePicker
have now available[Parameter] BoundaryAdjustmentMode
☑️ Self Check before Merge