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

[Table]吸顶表头支持自定义滚动容器 #1052

Merged
merged 29 commits into from
Jun 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
49072ba
docs(notification): 插件调用与函数式调用
Feb 11, 2022
8e5badf
Merge remote-tracking branch 'upstream/develop' into develop
Feb 14, 2022
5d3dd2a
Merge remote-tracking branch 'upstream/develop' into develop
Feb 15, 2022
df1f39a
Merge remote-tracking branch 'upstream/develop' into develop
chaishi Mar 23, 2022
e9a6f2e
Merge remote-tracking branch 'upstream/develop' into develop
chaishi Mar 28, 2022
993a2a4
Merge remote-tracking branch 'upstream/develop' into develop
chaishi Mar 29, 2022
bbe4c10
fix(table): merged cells border style
chaishi Mar 29, 2022
51a9b4b
feat: merge from upstream/develop
chaishi Mar 31, 2022
93a15e0
Merge remote-tracking branch 'upstream/develop' into develop
chaishi Apr 21, 2022
e57dd2d
Merge remote-tracking branch 'upstream/develop' into develop
chaishi Apr 25, 2022
36d3778
Merge remote-tracking branch 'upstream/develop' into develop
chaishi Apr 30, 2022
1db46ab
Merge remote-tracking branch 'upstream/develop' into develop
chaishi May 10, 2022
edd9e3b
Merge remote-tracking branch 'upstream/develop' into develop
chaishi May 10, 2022
9b4b001
Merge remote-tracking branch 'upstream/develop' into develop
chaishi May 13, 2022
267b4ea
Merge remote-tracking branch 'upstream/develop' into develop
chaishi May 16, 2022
95996fe
Merge remote-tracking branch 'upstream/develop' into develop
chaishi May 21, 2022
871f1b1
fix(table): toggleData and FoldAll
chaishi May 21, 2022
f5bb2e9
fix(table): 树形结构中,动态设置行选中列时,禁用功能失效
chaishi May 21, 2022
d310f05
Merge remote-tracking branch 'upstream/develop' into develop
chaishi May 29, 2022
7456a08
Merge remote-tracking branch 'upstream/develop' into develop
chaishi Jun 4, 2022
93e760c
Merge remote-tracking branch 'upstream/develop' into develop
chaishi Jun 5, 2022
2104f83
Merge remote-tracking branch 'upstream/develop' into develop
chaishi Jun 10, 2022
5565aee
Merge remote-tracking branch 'upstream/develop' into develop
chaishi Jun 11, 2022
bcd4aec
Merge remote-tracking branch 'upstream/develop' into develop
chaishi Jun 15, 2022
2035057
Merge remote-tracking branch 'upstream/develop' into develop
chaishi Jun 17, 2022
f09ea8e
Merge remote-tracking branch 'upstream/develop' into develop
chaishi Jun 22, 2022
b174024
fix(table): 吸顶表头支持自定义滚动容器
chaishi Jun 22, 2022
d78c541
test(table): update snapshots
chaishi Jun 22, 2022
9bf1ebd
test(table): update snapshots
chaishi Jun 22, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/table/base-table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ export default defineComponent({
showAffixFooter,
showAffixPagination,
onHorizontalScroll,
updateAffixHeaderOrFooter,
setTableContentRef,
} = useAffix(props);

Expand Down Expand Up @@ -147,6 +148,7 @@ export default defineComponent({
const onFixedChange = () => {
nextTick(() => {
onHorizontalScroll();
updateAffixHeaderOrFooter();
});
};

Expand Down Expand Up @@ -271,6 +273,7 @@ export default defineComponent({
handleRowMounted,
onFixedChange,
onHorizontalScroll,
updateAffixHeaderOrFooter,
refreshTable,
onInnerVirtualScroll,
};
Expand Down Expand Up @@ -299,7 +302,8 @@ export default defineComponent({
// onlyVirtualScrollBordered 用于浏览器兼容性处理,只有 chrome 需要调整 bordered,FireFox 和 Safari 不需要
const onlyVirtualScrollBordered = !!(this.isVirtual && !this.headerAffixedTop && this.bordered) && /Chrome/.test(navigator?.userAgent);
const borderWidth = this.bordered && onlyVirtualScrollBordered ? 1 : 0;
const affixHeaderWrapHeight = (this.affixHeaderRef?.getBoundingClientRect().height || 0) - this.scrollbarWidth - borderWidth;
const barWidth = this.isWidthOverflow ? this.scrollbarWidth : 0;
const affixHeaderWrapHeight = (this.affixHeaderRef?.getBoundingClientRect().height || 0) - barWidth - borderWidth;
// 两类场景:1. 虚拟滚动,永久显示表头,直到表头消失在可视区域; 2. 表头吸顶,根据滚动情况判断是否显示吸顶表头
const headerOpacity = props.headerAffixedTop ? Number(this.showAffixHeader) : 1;
const affixHeaderWrapHeightStyle = {
Expand Down Expand Up @@ -343,7 +347,7 @@ export default defineComponent({
/**
* Affixed Footer
*/
let marginScrollbarWidth = this.isWidthOverflow ? this.scrollbarWidth : 0;
let marginScrollbarWidth = barWidth;
if (this.bordered) {
marginScrollbarWidth += 1;
}
Expand Down
1 change: 1 addition & 0 deletions src/table/hooks/useAffix.ts
Original file line number Diff line number Diff line change
Expand Up @@ -246,5 +246,6 @@ export default function useAffix(props: TdBaseTableProps) {
paginationRef,
onHorizontalScroll,
setTableContentRef,
updateAffixHeaderOrFooter,
};
}
2 changes: 1 addition & 1 deletion test/ssr/__snapshots__/ssr.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -13549,7 +13549,7 @@ exports[`ssr snapshot test renders ./examples/table/demos/affix.vue correctly 1`
<div class="t-table t-table--bordered t-table--affixed-header t-table--footer-affixed t-table--column-fixed t-table--col-draggable" style="position:relative;">
<div offsetTop="0">
<div>
<div class="t-table__affixed-header-elm-wrap" style="width:0px;height:-6px;opacity:1;margin-top:0;"></div>
<div class="t-table__affixed-header-elm-wrap" style="width:0px;height:0px;opacity:1;margin-top:0;"></div>
</div>
</div>
<div class="t-table__content">
Expand Down
2 changes: 1 addition & 1 deletion test/unit/table/__snapshots__/demo.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ exports[`Table Table affixVue demo works fine 1`] = `
<div>
<div
class="t-table__affixed-header-elm-wrap"
style="width: 0px; height: -6px; opacity: 1; margin-top: 0px;"
style="width: 0px; height: 0px; opacity: 1; margin-top: 0px;"
/>
</div>
</div>
Expand Down