Skip to content

Commit

Permalink
Merge pull request #2608 from XiaoMi/hotfix/table(#2596)
Browse files Browse the repository at this point in the history
Hotfix/table(#2596)
  • Loading branch information
solarjoker authored Sep 25, 2023
2 parents a6054b1 + e44cd94 commit 241cd97
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 18 deletions.
5 changes: 5 additions & 0 deletions .changeset/red-books-shake.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@hi-ui/table": patch
---

fix: 修复紧凑模式下多选项间距问题
5 changes: 5 additions & 0 deletions .changeset/smart-onions-tan.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@hi-ui/hiui": patch
---

Table fix: 修复紧凑模式下多选项间距问题
2 changes: 1 addition & 1 deletion packages/ui/table/src/BaseTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export const BaseTable = forwardRef<HTMLDivElement | null, BaseTableProps>(
onEmbedExpand,
expandedRender,
// 其它
size,
size = 'md',
extra,
onRow,
onHeaderRow,
Expand Down
50 changes: 36 additions & 14 deletions packages/ui/table/src/styles/table.scss
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,20 @@ $emptyContent: '#{$component-prefix}-table-empty-content' !default;
tbody {
& > tr:not(.#{$emptyContent}) > td {
padding: use-spacing(7);

&.#{$prefix}__selection-col {
padding: use-spacing(7) use-spacing(5);
}
}
}

thead {
& > tr > th {
padding: use-spacing(7);

&.#{$prefix}__selection-col {
padding: use-spacing(7) use-spacing(5);
}
}
}
}
Expand All @@ -59,12 +67,20 @@ $emptyContent: '#{$component-prefix}-table-empty-content' !default;
tbody {
& > tr:not(.#{$emptyContent}) > td {
padding: use-spacing(5);

&.#{$prefix}__selection-col {
padding: use-spacing(5);
}
}
}

thead {
& > tr > th {
padding: use-spacing(5);

&.#{$prefix}__selection-col {
padding: use-spacing(5);
}
}
}
}
Expand All @@ -75,12 +91,20 @@ $emptyContent: '#{$component-prefix}-table-empty-content' !default;
tbody {
& > tr:not(.#{$emptyContent}) > td {
padding: use-spacing(9);

&.#{$prefix}__selection-col {
padding: use-spacing(9) use-spacing(5);
}
}
}

thead {
& > tr > th {
padding: use-spacing(9);

&.#{$prefix}__selection-col {
padding: use-spacing(9) use-spacing(5);
}
}
}
}
Expand Down Expand Up @@ -161,6 +185,17 @@ $emptyContent: '#{$component-prefix}-table-empty-content' !default;

&-cell {
background-color: use-color('gray', 50);
color: use-color('gray', 700);
font-size: use-text-size('normal');
font-weight: use-text-weight('medium');
line-height: use-text-lineheight('sm');
padding: use-spacing(7) use-spacing(8);
border-bottom: use-border-size('normal') use-color('gray', 300);

&.#{$prefix}__embed-col,
&.#{$prefix}__selection-col {
padding: use-spacing(7) use-spacing(5);
}

$this: &;

Expand Down Expand Up @@ -241,6 +276,7 @@ $emptyContent: '#{$component-prefix}-table-empty-content' !default;
}
}
}

&--virtual {
display: flex;
}
Expand Down Expand Up @@ -270,20 +306,6 @@ $emptyContent: '#{$component-prefix}-table-empty-content' !default;
overflow: auto;
}

.#{$prefix}-header-cell {
color: use-color('gray', 700);
font-size: use-text-size('normal');
font-weight: use-text-weight('medium');
line-height: use-text-lineheight('sm');
padding: use-spacing(7) use-spacing(8);
border-bottom: use-border-size('normal') use-color('gray', 300);

&.#{$prefix}__embed-col,
&.#{$prefix}__selection-col {
padding: use-spacing(7) use-spacing(5);
}
}

// 单元格
.#{$prefix}-cell {
word-break: break-word;
Expand Down
6 changes: 3 additions & 3 deletions packages/ui/table/stories/size.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -231,13 +231,13 @@ export const Size = () => {
<>
<h1>Size for Table</h1>
<div className="table-size__wrap" style={{ minWidth: 660, background: '#fff' }}>
<Table bordered columns={column} data={data} size="sm" />
<Table bordered columns={column} data={data} size="sm" rowSelection={{}} />
<br />
<br />
<Table bordered columns={column} data={data} size="md" />
<Table bordered columns={column} data={data} size="md" rowSelection={{}} />
<br />
<br />
<Table bordered columns={column} data={data} size="lg" />
<Table bordered columns={column} data={data} size="lg" rowSelection={{}} />
</div>
</>
)
Expand Down

0 comments on commit 241cd97

Please sign in to comment.