Skip to content

Commit 3c98b1f

Browse files
committed
Optimize: The query result cancels in-cell scrolling and instead uses hover to view cell contents
1 parent 0d068e9 commit 3c98b1f

4 files changed

Lines changed: 50 additions & 34 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
- ⭐【New Features】Run record sql to open the console directly
99
- ⭐【New Features】The SQL column on the right of execution record and save can be expanded and dragged
1010
- 🐞【Fixed】Some databases could not display the Database/Schema structure
11+
- ⚡️【Optimize】The query result cancels in-cell scrolling and instead uses hover to view cell contents
1112

1213
## 3.1.15
1314

CHANGELOG_CN.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
- ⭐【新功能】执行记录sql可直接打开控制台
99
- ⭐【新功能】右侧执行记录、保存SQL栏展开大小可拖动
1010
- 🐞【修复】部分数据库无法显示数据库/Schema结构的问题
11+
- ⚡️【优化】查询结果取消单元格内滚动,改为hover查看单元格内容
1112

1213
## 3.1.15
1314

chat2db-client/src/components/SearchResult/components/TableBox/index.less

Lines changed: 39 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,17 @@
3030
}
3131
}
3232
:global {
33+
.table{
34+
overflow: hidden;
35+
}
3336
.art-table {
3437
table colgroup col:nth-of-type(1) {
3538
min-width: 60px;
3639
}
37-
th,
38-
td {
39-
overflow: hidden;
40-
}
40+
// th,
41+
// td {
42+
// overflow: hidden;
43+
// }
4144
.fnWppk {
4245
// word-break: break-all;
4346
// display: -webkit-box;
@@ -202,14 +205,14 @@
202205

203206
.tableItem {
204207
height: 31px;
205-
cursor: pointer;
206208
display: flex;
207209
align-items: center;
208210
justify-content: space-between;
209211
position: relative;
210212
padding-left: 4px;
211213
user-select: none;
212214
background-color: var(--color-bg-base);
215+
cursor: pointer;
213216

214217
.tableItemContent {
215218
max-height: 31px;
@@ -218,16 +221,33 @@
218221
width: 100%;
219222
overflow: hidden;
220223
white-space: nowrap;
221-
&:hover {
222-
overflow-x: auto;
223-
// line-height: 14px;
224-
}
224+
text-overflow: ellipsis;
225+
}
226+
227+
.previewTableItemContent{
228+
display: none;
229+
position: absolute;
230+
left: 0px;
231+
top: 0px;
232+
bottom: 0px;
233+
width: fit-content;
234+
min-width: 100%;
235+
padding: 0px 4px;
236+
max-height: 31px;
237+
line-height: 31px;
238+
background-color: var(--color-bg-layout);
239+
z-index: 2;
240+
color: var(--color-text);
241+
white-space: nowrap;
225242
}
226243

227244
&:hover {
228-
.tableHoverBox {
245+
.previewTableItemContent {
229246
display: flex;
230247
}
248+
.previewTableItemContent {
249+
display: block;
250+
}
231251
}
232252

233253
.cellValueNull {
@@ -241,20 +261,24 @@
241261

242262
.tableItemEdit {
243263
background-color: var(--color-success-bg);
244-
.tableHoverBox {
264+
.previewTableItemContent {
245265
background-color: var(--color-success-bg);
246266
}
267+
247268
}
248269
.tableItemHighlight {
249270
background-color: var(--color-bg-subtle);
250-
.tableHoverBox {
271+
.previewTableItemContent {
251272
background-color: var(--color-bg-subtle);
252273
}
253274
}
254275
.tableItemFocus {
255276
background-color: var(--color-primary-hover);
256277
color: var(--color-bg-base);
257-
.tableHoverBox {
278+
.previewTableItemContent {
279+
background-color: var(--color-primary-hover);
280+
}
281+
.previewTableItemContent{
258282
background-color: var(--color-primary-hover);
259283
}
260284
.cellValueNull {
@@ -263,13 +287,13 @@
263287
}
264288
.tableItemSuccess {
265289
background-color: var(--color-success-bg);
266-
.tableHoverBox {
290+
.previewTableItemContent {
267291
background-color: var(--color-success-bg);
268292
}
269293
}
270294
.tableItemError {
271295
background-color: var(--color-error-bg);
272-
.tableHoverBox {
296+
.previewTableItemContent {
273297
background-color: var(--color-error-bg);
274298
}
275299
}
@@ -279,24 +303,6 @@
279303
text-align: center;
280304
}
281305

282-
.tableHoverBox {
283-
position: sticky;
284-
height: 31px;
285-
top: 0px;
286-
bottom: 0px;
287-
right: 0px;
288-
width: 40px;
289-
display: none;
290-
align-items: center;
291-
cursor: pointer;
292-
background-color: var(--color-bg-base);
293-
294-
i {
295-
font-size: 15px;
296-
margin: 0px 2px;
297-
}
298-
}
299-
300306
.pagination {
301307
:global {
302308
.ant-pagination-prev,

chat2db-client/src/components/SearchResult/components/TableBox/index.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -656,6 +656,7 @@ export default function TableBox(props: ITableProps) {
656656
// title: <div>{name}</div>,
657657
render: (value: any, rowData) => {
658658
const rowId = rowData[colNoCode];
659+
const content = renderTableCellValue(value);
659660
return (
660661
<div
661662
data-chat2db-general-can-copy-element
@@ -679,7 +680,14 @@ export default function TableBox(props: ITableProps) {
679680
}}
680681
/>
681682
) : (
682-
<div className={styles.tableItemContent}>{renderTableCellValue(value)}</div>
683+
<>
684+
<div className={styles.tableItemContent}>
685+
{content}
686+
</div>
687+
<div className={styles.previewTableItemContent}>
688+
{content}
689+
</div>
690+
</>
683691
)}
684692
</div>
685693
);

0 commit comments

Comments
 (0)