fix: keep template table cells compact with Semi tooltips

This commit is contained in:
yuxuanhui
2026-09-13 14:31:03 +08:00
parent 8444e3055e
commit db449f0915
2 changed files with 50 additions and 19 deletions
+29 -10
View File
@@ -15,7 +15,9 @@ import {
Table,
TextArea,
Toast,
Typography,
} from "@douyinfe/semi-ui-19";
import { WorkspaceTable } from "../components/WorkspaceTable";
import { ResearchInput } from "../ai/ResearchInput";
import { IconAIEditLevel3 } from "@douyinfe/semi-icons";
import { api, post, formatTime } from "../api";
@@ -354,20 +356,20 @@ export function ResearchWorkspace({
}
>
{listMode === "assets" ? (
<>
<Table<Asset>
className="research-table"
<div className="research-template-table-container">
<WorkspaceTable<Asset>
key={JSON.stringify([search, assetPage])}
fill
dataSource={assets}
rowKey="id"
pagination={false}
size="small"
sticky
style={{ minWidth: 720 }}
scroll={{ x: 800, y: "100%" }}
empty="还没有模板。新建或导入一个模板开始研究。"
columns={[
{
title: "模板名称",
key: "name",
width: 280,
ellipsis: { showTitle: false },
render: (_, item) => (
<Button
theme="borderless"
@@ -383,8 +385,14 @@ export function ResearchWorkspace({
setDetailOpen(true);
})
}
>
<Typography.Text
size="inherit"
style={{ width: "100%", color: "inherit" }}
ellipsis={{ showTooltip: true }}
>
{item.name}
</Typography.Text>
</Button>
),
},
@@ -397,8 +405,17 @@ export function ResearchWorkspace({
{
title: "表达式",
key: "expression",
width: 260,
render: (_, item) => <code>{item.content.expression}</code>,
width: undefined,
ellipsis: { showTitle: false },
render: (_, item) => (
<Typography.Text
className="research-template-expression"
style={{ width: "100%" }}
ellipsis={{ showTooltip: true }}
>
{item.content.expression}
</Typography.Text>
),
},
{
title: "分类",
@@ -412,6 +429,7 @@ export function ResearchWorkspace({
key: "actions",
width: 80,
render: (_, item) => (
<div className="workspace-cell-actions">
<DeleteResearchButton
name={item.name}
label="模板"
@@ -420,11 +438,12 @@ export function ResearchWorkspace({
task("删除模板", () => removeAsset(item))
}
/>
</div>
),
},
]}
/>
</>
</div>
) : (
<>
<Table<(typeof history)[number]>
+12
View File
@@ -104,6 +104,18 @@
.research-table-scroll {
overflow-x: auto;
}
.research-template-table-container {
display: flex;
flex-direction: column;
height: 100%;
min-height: 0;
min-width: 0;
overflow: hidden;
}
.research-template-expression {
font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
font-size: 12px;
}
.research-table .semi-table-row-cell {
vertical-align: top;
overflow-wrap: anywhere;