Skip to content
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/cyan-maps-cross.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@td-design/lego': patch
---

fix: 修复Table组件字段折行的问题
4 changes: 2 additions & 2 deletions packages/lego/src/cylinder-bar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export default forwardRef<ReactEcharts, CylinderBarProps>(
(
{
xAxisData,
seriesData,
seriesData = [{ unit: '' }, { unit: '' }],
style,
/** 控制是否自动轮播 */
autoLoop,
Expand Down Expand Up @@ -119,7 +119,7 @@ export default forwardRef<ReactEcharts, CylinderBarProps>(
...baseChartConfig.xAxis,
},
yAxis,
series: createCylinderBarSeries(data, colors, yAxisCount),
series: createCylinderBarSeries(data as BarSeriesData[], colors, yAxisCount),
},
config
);
Expand Down
3 changes: 3 additions & 0 deletions packages/lego/src/table/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@

.text {
text-align: center;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
}
}
Expand Down
11 changes: 5 additions & 6 deletions packages/lego/src/table/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export type Column<T = any> = {
flex?: number;
/** 文字对齐方式 */
textAlign?: TextAlign;
render?: (data: T) => ReactElement;
render?: (data: T, index: number) => ReactElement;
};

export type CustomTableProps<T> = {
Expand Down Expand Up @@ -91,7 +91,7 @@ function Table<T extends Record<string, any>>({
style={{
...theme.typography[inModal ? 'p0' : 'p2'],
lineHeight: inModal ? '25px' : '19px',
textAlign: item.textAlign,
textAlign: 'center',
...cellStyle({
width: item.width || `${100 / columns?.length}%`,
flex: item.flex,
Expand Down Expand Up @@ -134,7 +134,7 @@ function Table<T extends Record<string, any>>({
lineHeight: inModal ? '25px' : '19px',
}}
>
{columns.map(term => {
{columns.map((term, idx) => {
return (
<div
key={term.id}
Expand All @@ -144,11 +144,10 @@ function Table<T extends Record<string, any>>({
width: term.width || `${100 / columns?.length}%`,
flex: term.flex,
}),
alignItems: 'center',
textAlign: term.textAlign,
textAlign: term.textAlign || 'center',
}}
>
{term.render ? term.render(item) : item?.[term.dataIndex]}
{term.render ? term.render(item, index) : item?.[term.dataIndex]}
</div>
);
})}
Expand Down