fix: 修复二级弹窗表格表头固顶位置不正确问题 Close: #7153

This commit is contained in:
2betop 2023-06-14 21:02:44 +08:00
parent 796db753fb
commit ef3b3c6314
4 changed files with 8 additions and 16 deletions

View File

@ -1880,7 +1880,6 @@ exports[`Renderer: crud sortable & orderBy & orderDir & orderField 1`] = `
</div>
<div
class="cxd-Table-fixedTop"
style="top: 0px; width: 0px;"
>
<div
class="cxd-Table-fixedLeft"
@ -4543,7 +4542,6 @@ exports[`Renderer:crud source & alwaysShowPagination 1`] = `
</div>
<div
class="cxd-Table-fixedTop"
style="top: 0px; width: 0px;"
>
<div
class="cxd-Table-fixedLeft"

View File

@ -243,7 +243,6 @@ exports[`Renderer:Pagination 1`] = `
</div>
<div
class="cxd-Table-fixedTop"
style="top: 0px; width: 0px;"
>
<div
class="cxd-Table-heading"

View File

@ -356,7 +356,6 @@ exports[`Renderer:table 1`] = `
</div>
<div
class="cxd-Table-fixedTop"
style="top: 0px; width: 0px;"
>
<div
class="cxd-Table-heading"
@ -818,7 +817,6 @@ exports[`Renderer:table align 1`] = `
</div>
<div
class="cxd-Table-fixedTop"
style="top: 0px; width: 0px;"
>
<div
class="cxd-Table-heading"
@ -1469,7 +1467,6 @@ exports[`Renderer:table children 1`] = `
</div>
<div
class="cxd-Table-fixedTop"
style="top: 0px; width: 0px;"
>
<div
class="cxd-Table-fixedLeft"
@ -2021,7 +2018,6 @@ exports[`Renderer:table classNameExpr 1`] = `
</div>
<div
class="cxd-Table-fixedTop"
style="top: 0px; width: 0px;"
>
<div
class="cxd-Table-heading"
@ -2653,7 +2649,6 @@ exports[`Renderer:table column head style className 1`] = `
</div>
<div
class="cxd-Table-fixedTop"
style="top: 0px; width: 0px;"
>
<div
class="cxd-Table-heading"
@ -3316,7 +3311,6 @@ exports[`Renderer:table combine Renderer:table combineNum only 1`] = `
</div>
<div
class="cxd-Table-fixedTop"
style="top: 0px; width: 0px;"
>
<div
class="cxd-Table-fixedLeft"
@ -4089,7 +4083,6 @@ exports[`Renderer:table combine Renderer:table combineNum with fromIndex 1`] = `
</div>
<div
class="cxd-Table-fixedTop"
style="top: 0px; width: 0px;"
>
<div
class="cxd-Table-fixedLeft"
@ -4993,7 +4986,6 @@ exports[`Renderer:table groupName-default 1`] = `
</div>
<div
class="cxd-Table-fixedTop"
style="top: 0px; width: 0px;"
>
<div
class="cxd-Table-toolbar cxd-Table-headToolbar"
@ -5959,7 +5951,6 @@ exports[`Renderer:table groupName-middleNoGroupName 1`] = `
</div>
<div
class="cxd-Table-fixedTop"
style="top: 0px; width: 0px;"
>
<div
class="cxd-Table-toolbar cxd-Table-headToolbar"
@ -6920,7 +6911,6 @@ exports[`Renderer:table groupName-startNoGroupName 1`] = `
</div>
<div
class="cxd-Table-fixedTop"
style="top: 0px; width: 0px;"
>
<div
class="cxd-Table-toolbar cxd-Table-headToolbar"
@ -7877,7 +7867,6 @@ exports[`Renderer:table groupName-withTpl 1`] = `
</div>
<div
class="cxd-Table-fixedTop"
style="top: 0px; width: 0px;"
>
<div
class="cxd-Table-toolbar cxd-Table-headToolbar"
@ -8639,7 +8628,6 @@ exports[`Renderer:table isHead fixed 1`] = `
</div>
<div
class="cxd-Table-fixedTop"
style="top: 0px; width: 0px;"
>
<div
class="cxd-Table-heading"

View File

@ -667,7 +667,7 @@ export default class Table extends React.Component<TableProps, object> {
return;
}
this.affixDetect();
requestAnimationFrame(this.affixDetect);
parent.addEventListener('scroll', this.affixDetect);
window.addEventListener('resize', this.affixDetect);
this.updateAutoFillHeight();
@ -1162,6 +1162,13 @@ export default class Table extends React.Component<TableProps, object> {
const ns = this.props.classPrefix;
const dom = findDOMNode(this) as HTMLElement;
const clip = (this.table as HTMLElement).getBoundingClientRect();
// 还在动画中,跳过。过一会再试。
if (this.table.offsetWidth && clip.width / this.table.offsetWidth < 0.5) {
setTimeout(this.affixDetect, 200);
return;
}
const offsetY =
this.props.affixOffsetTop ?? this.props.env.affixOffsetTop ?? 0;
const headingHeight =