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

Hotfix/table(#2596) #2608

Merged
merged 2 commits into from
Sep 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
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