Skip to content

Commit 5ec3946

Browse files
committed
fix(style): 修复横向滚动,竖向滚动的样式 bug
1 parent 011b196 commit 5ec3946

5 files changed

Lines changed: 11 additions & 25 deletions

File tree

packages/docs/demos/native/BasicDemo.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const columns: EditableColumn<User>[] = [
2121
title: '姓名',
2222
dataIndex: 'name',
2323
width: 140,
24-
fixed: 'left',
24+
// fixed: 'left',
2525
rules: [{ required: true, message: '姓名不能为空' }],
2626
editRender: ({ value, onChange }) => (
2727
<input className="et-editor-input" value={value} onChange={(e) => onChange(e.target.value)} />

packages/docs/demos/native/LargeScrollDemo.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ export default function LargeScrollDemo() {
155155
500 行 × 10 列,虚拟滚动 + 横向滚动,姓名列左侧固定,操作列右侧固定
156156
</p>
157157
<EditableTable<Row>
158+
bordered
158159
rowKey="id"
159160
dataSource={dataSource}
160161
onChange={setDataSource}

packages/docs/native/performance.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ EditableTable 基于 `@tanstack/react-virtual` 实现虚拟滚动,只渲染可
2020
### 500 行 × 10 列 + 横向滚动
2121

2222
<ClientOnly>
23-
<ReactDemo :component="LargeScrollDemo" :source="LargeScrollDemoSource" title="10 列横向滚动" description="500 行 × 10 列,虚拟滚动 + 横向滚动,左右列固定" />
23+
<ReactDemo :component="LargeScrollDemo" :source="LargeScrollDemoSource" title="10 列横向滚动" />
2424
</ClientOnly>
2525

2626
## 启用虚拟滚动

packages/editable-table/src/components/EditableTable/EditableTable.css

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,6 @@
4848
width: 100%;
4949
}
5050

51-
/* 有竖向滚动条时,表头保留等宽的不可见滚动条,使内容区宽度与表体一致 */
52-
.et-scroll-x-vscroll {
53-
overflow-y: scroll;
54-
scrollbar-color: transparent transparent;
55-
}
56-
.et-scroll-x-vscroll::-webkit-scrollbar {
57-
background: transparent;
58-
}
59-
6051
/* ===== 表格内容区:列少时撑满容器,列多时允许溢出 ===== */
6152
.et-inner {
6253
width: fit-content;
@@ -93,13 +84,12 @@
9384
}
9485

9586
.et-body::-webkit-scrollbar {
96-
width: 6px;
87+
width: 0;
9788
height: 4px;
9889
}
9990

100-
.et-body::-webkit-scrollbar-thumb {
101-
background: #c1c1c1;
102-
border-radius: 3px;
91+
.et-body {
92+
scrollbar-width: none;
10393
}
10494

10595
.et-row {
@@ -327,15 +317,6 @@
327317
background: var(--et-row-hover-bg);
328318
}
329319

330-
/* 固定列右侧/左侧阴影 */
331-
.et-fixed-left {
332-
border-right: 1px solid var(--et-border-color);
333-
}
334-
335-
.et-fixed-right {
336-
border-left: 1px solid var(--et-border-color);
337-
}
338-
339320
/* ===== Bordered 模式 ===== */
340321
.et-bordered .et-header-cell,
341322
.et-bordered .et-cell {

packages/editable-table/src/components/EditableTable/index.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,10 @@ function EditableTable<T extends object = Record<string, unknown>>(
367367
<div
368368
className={`et-table${bordered ? ' et-bordered' : ''}${scrollShadow.left ? ' et-scroll-left' : ''}${scrollShadow.right ? ' et-scroll-right' : ''}`}
369369
>
370-
<div ref={headerScrollRef} className={`et-scroll-x${scrollY != null ? ' et-scroll-x-vscroll' : ''}`}>
370+
<div
371+
ref={headerScrollRef}
372+
className="et-scroll-x"
373+
>
371374
<div className="et-inner">
372375
<div className="et-header" style={{ display: 'grid', gridTemplateColumns: gridTemplate }}>
373376
{columns.map((col, colIndex) => {
@@ -438,6 +441,7 @@ function EditableTable<T extends object = Record<string, unknown>>(
438441
minWidth: '100%',
439442
transform: `translateY(${virtualRow.start}px)`,
440443
height: `${virtualRow.size}px`,
444+
borderBottom: 'none',
441445
}}
442446
>
443447
{columns.map((col, colIndex) => {

0 commit comments

Comments
 (0)