Skip to content

Commit

Permalink
fix(table): 修复合并单元格边框样式问题 (#3005) (#3007)
Browse files Browse the repository at this point in the history
  • Loading branch information
zyprepare authored Sep 26, 2024
1 parent e9aadf1 commit 9b9a448
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 33 deletions.
5 changes: 5 additions & 0 deletions .changeset/blue-impalas-brake.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@hi-ui/hiui": patch
---

fix(table): 修复合并单元格边框样式问题
5 changes: 5 additions & 0 deletions .changeset/tame-eels-pump.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@hi-ui/table": patch
---

fix: 修复合并单元格边框样式问题
3 changes: 3 additions & 0 deletions packages/ui/table/src/BaseTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,8 @@ export const BaseTable = forwardRef<HTMLDivElement | null, BaseTableProps>(
} = providedValue

const hasBorder = borderedProp ?? bordered
const hasScrollToLeft = scrollSize.scrollLeft === 0
const hasLeftFixedColumns = leftFrozenColKeys.length > 0

const extraHeader = extra && extra.header
const extraFooter = extra && extra.footer
Expand Down Expand Up @@ -290,6 +292,7 @@ export const BaseTable = forwardRef<HTMLDivElement | null, BaseTableProps>(
prefixCls,
className,
hasBorder && `${prefixCls}--bordered`,
(hasScrollToLeft || hasLeftFixedColumns) && `${prefixCls}--bordered-left-none`,
striped && `${prefixCls}--striped`,
size && `${prefixCls}--size-${size}`,
virtual && `${prefixCls}--virtual`
Expand Down
54 changes: 21 additions & 33 deletions packages/ui/table/src/styles/table.scss
Original file line number Diff line number Diff line change
Expand Up @@ -106,54 +106,42 @@ $emptyContent: '#{$component-prefix}-table-body-empty-content' !default;
}

&--bordered {
table {
thead {
& > tr > th:not(:last-child) {
border-right: use-border-size('normal') use-color('gray', 200);
}

& > tr:has(+ tr) {
th:not(.#{$prefix}-header-cell--group-last-column) {
border-right: use-border-size('normal') use-color('gray', 200);
}
}
> .#{$prefix}__wrapper {
border: use-border-size('normal') use-color('gray', 200);

& > tr + tr:last-child {
th {
border-right: use-border-size('normal') use-color('gray', 200);
}
}
.#{$prefix}-header-cell, .#{$prefix}-cell {
border-left: use-border-size('normal') use-color('gray', 200);
}

tr {
.#{$prefix}-row {
&:last-child {
td {
.#{$prefix}-cell {
border-bottom: none;
}
}

td:not(:last-child) {
border-right: use-border-size('normal') use-color('gray', 200);
}
}
}

.#{$prefix}__wrapper {
border: use-border-size('normal') use-color('gray', 200);
&.#{$prefix}--bordered-left-none {
> .#{$prefix}__wrapper {
border-left: none;
}
}

&.#{$prefix}--virtual {
.#{$prefix}-row {
.#{$prefix}-cell:not(:last-child) {
border-right: use-border-size('normal') use-color('gray', 200);
> .#{$prefix}__wrapper {
.#{$prefix}-row {
.#{$prefix}-cell {
border-bottom: use-border-size('normal') use-color('gray', 200);
}
}
}

.#{$prefix}-virtual-row {
&:last-child {
.#{$prefix}-row {
.#{$prefix}-cell {
border-bottom: none;
.#{$prefix}-virtual-row {
&:last-child {
.#{$prefix}-row {
.#{$prefix}-cell {
border-bottom: none;
}
}
}
}
Expand Down

0 comments on commit 9b9a448

Please sign in to comment.