Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
xiaopingyi opened this issue Oct 25, 2023 · 0 comments

Comments

@xiaopingyi
Copy link

🐛 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<any>[] = [
  {
    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" ? (
        <Input />
      ) : (
        <Select></Select>
      );
    }
  }
];

export default () => {
  return (
    <ProTable
      columns={columns}
      cardBordered
      request={async (params = {}, sort, filter) => {
        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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant