ant-design / ant-design/pro-components

🐛[BUG] 当出现 valueEnum 属性的时,text 组件被错误渲染为 select 组件

Open
#9,002 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
TypeScript
Stars
4.8k
Forks
1.4k
Avg merge
10h 44m
Merged PRs (30d)
3

Description

### 🐛 bug 描述

指定表格的 valueType 为 text,但当出现 valueEnum 的时候,组件就被渲染为 select 组件了,不在是输入框组件。

### 📷 复现步骤

在线链接:

https://stackblitz.com/edit/vitejs-vite-tst7qpsn?file=src%2Fdemo.tsx

表格表头代码:

```ts
const columns: ProColumns[] = [
{
title: 'This is a text component',
dataIndex: 'title',
width: '20%',
// 这里
valueType: 'text',
valueEnum: {
all: { text: 'All', status: 'Default' },
open: {
text: 'open',
status: 'Error',
},
closed: {
text: 'closed',
status: 'Success',
},
},
},
{
title: 'Status',
key: 'state',
dataIndex: 'state',
valueType: 'select',
valueEnum: {
all: { text: 'All', status: 'Default' },
open: {
text: '未解决',
status: 'Error',
},
closed: {
text: '已解决',
status: 'Success',
},
},
},
];
```

第一列应该是一个输入框,因为指定了 valueEnum 被错误渲染为 Select 组件了。

Image

### 🏞 期望结果

Image

### © 版本信息

- ProComponents 版本: 2.8.4
- ant design 5.24.4

Contributor guide

Open the contributing guide

Research direction

Start with the linked StackBlitz reproduction and the ProColumns definition for the first column. Trace how valueType: 'text' and valueEnum are interpreted, then verify that this column renders an input while the second valueType: 'select' column remains a select. Done means the reproduction matches the expected screenshots without regressing the select case.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.