fix(Table): use flex layout remove javascript observer height update#7920
Conversation
|
Thanks for your PR, @Tony-ST0754. Someone from the team will get assigned to your PR shortly and we'll get it reviewed. |
Reviewer's guide (collapsed on small PRs)Reviewer's GuideAdjusts the Table component container and sub-sections to use a flex column layout with controlled flex-shrink behavior and box-sizing so that the fixed-header table body resizes correctly without height jitter when search and toolbar areas change height. Flow diagram for Table container flex layout structureflowchart TD
table_container[".table-container (display:flex, flex-direction:column, box-sizing:border-box, height:100%)"]
table_search[".table-search (flex-shrink:0, box-sizing:border-box)"]
table_toolbar[".table-toolbar (flex-shrink:0, box-sizing:border-box)"]
table_fixed[".table-fixed/.table-shim (flex-shrink:1, box-sizing:border-box, height:100%, overflow:hidden)"]
nav_pages[".nav-pages (flex-shrink:0, box-sizing:border-box, margin-block-start:.5rem)"]
table_container --> table_search
table_container --> table_toolbar
table_container --> table_fixed
table_container --> nav_pages
File-Level Changes
Assessment against linked issues
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- For the main table body (
.table-fixed), relying onheight: 100%inside a flex container can be fragile; consider usingflex: 1 1 auto(and possibly droppingheight: 100%) so it naturally takes the remaining space and behaves more predictably in nested layouts. - You’re adding
box-sizing: border-boxto multiple elements that likely already inherit it from a global rule; if that’s the case in this project, you can simplify by only setting it where behavior truly differs to avoid redundant declarations.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- For the main table body (`.table-fixed`), relying on `height: 100%` inside a flex container can be fragile; consider using `flex: 1 1 auto` (and possibly dropping `height: 100%`) so it naturally takes the remaining space and behaves more predictably in nested layouts.
- You’re adding `box-sizing: border-box` to multiple elements that likely already inherit it from a global rule; if that’s the case in this project, you can simplify by only setting it where behavior truly differs to avoid redundant declarations.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7920 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 765 765
Lines 34124 34124
Branches 4684 4684
=========================================
Hits 34124 34124
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
(修正)Table组件高度溢出Issues #7901
Link issues
fixes #7901
问题描述 / Problem Description
当
Table组件启用IsFixedHeader属性值为true,且Height指定了固定值时,由于组件可能在使用过程中将搜索面板置于Table组件顶部,且搜索面板的高度值是会随着开发人员给定的搜索条件的数量来变化,因此,导致需要重算Table组件的主体部分的高度,因此,在页面渲染时出现的高度“抖动”或“由高变低”的现象。解决方案 / Solution
经仔细观察
Table组件渲染生成时.table-container下主要分为四大块:1、
.table-search当组件将SearchMode属性设为SearchMode.Top时生成2、
.table-toolbar当组件将ShowToolbar属性设为true时生成3、
.table-shim组件的主体部分,当IsFixedHeader为true时,则有.table-fixed4、
.nav-pages组件的分页控制部分采用flex响应式布局处理,方案如下:
思考:Table.razor.js中计算高度的过程是否还有必要保留?!
疑虑:目前我不确定是否还存在其他方面的功能需要用到这个计算
Risk
Verification
Packaging changes reviewed?
☑️ Self Check before Merge