ant-design / ant-design/pro-components

ProTable表单有依赖关系并且表单项必填时不能忽略search的规则配置🐛[BUG]

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

Description

### 🐛 bug 描述
定义ProTable的表单时,如果表单之间有互相依赖关系,并且表单项为必填时,搜索框不能忽略必填校验

### 📷 复现步骤

https://codesandbox.io/s/protableshe-zhi-dependenciesbu-neng-qu-xiao-searchde-bi-tian-xiao-yan-ny2n2r?file=/App.tsx
点击搜索提示请输入标签

### 🏞 期望结果

点击搜索时可取消标签的规则校验

### 💻 复现代码

```
import type { ProColumns } from "@ant-design/pro-components";
import { ProTable } from "@ant-design/pro-components";
import { Select } from "antd";
import Input from "antd/es/input/Input";

const columns: ProColumns[] = [
{
title: "状态",
dataIndex: "state",
valueType: "select",
valueEnum: {
open: {
text: "未解决",
status: "Error"
},
closed: {
text: "已解决",
status: "Success"
},
processing: {
text: "解决中",
status: "Processing"
}
}
},
{
title: "标签",
dataIndex: "labels",
valueType: "text",

dependencies: ["state"],
formItemProps: {
rules: [{ required: true }]
},
renderFormItem: (_, config, form) => {
return form.getFieldValue("state") === "open" ? (

) : (

);
}
}
];

export default () => {
return (
{
console.log(sort, filter);
return [];
}}
rowKey="id"
form={{
ignoreRules: true
}}
search={{
labelWidth: "auto",
ignoreRules: true
}}
/>
);
};
```
### © 版本信息

- ProComponents 版本: [e.g. 4.0.0]
- umi 版本
- 浏览器环境
- 开发环境 [e.g. mac OS]

### 🚑 其他信息

ProComponents 版本: 2.6.32
umi 版本:N.A.
浏览器环境:Chrome
开发环境:N.A.

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the linked CodeSandbox with ProTable's search form, dependencies, required rule, and ignoreRules settings. Trace the ProTable form and search handling entry points to determine why search still validates the dependent field. Done means the search action skips the required validation while the dependent form behavior remains intact.

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
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.