ant-design / pro-components

🏆 Use Ant Design like a Pro!
https://pro-components.antdigital.dev
MIT License
4.04k stars 1.29k forks source link

🐛[BUG] LightFilter表单下ProFormTreeSelect增加rules,修改后不会自动触发提交事件 #8198

Open BaoXianSheng opened 2 months ago

BaoXianSheng commented 2 months ago

🐛 bug 描述

LightFilter表单下ProFormTreeSelect增加rules,修改后不会自动触发提交事件

📷 复现步骤

不增加rules,选择后会自动触发onSubmit,增加后不会触发 在LightFilter中增加Button 会报 Warning: React does not recognize the fieldProps prop on a DOM element. If you intentionally want it to appear in the DOM as a custom attribute, spell it as lowercase fieldprops instead. If you accidentally passed it from a parent component, remove it from the DOM element.

🏞 期望结果

选择后,在验证rules成功的情况下自动触发onSubmit

💻 复现代码

<LightFilter<API.ElectricChartParams>
            bordered
            collapseLabel={<FilterOutlined />}
            onFinish={async (values) => {
              run(values);
            }}
          >
          <ProFormTreeSelect
                        request={()=> something}
                        name="locations"
                        label="区域"
                        rules={[requiredRule, { type: 'array', max: 8, min: 1 }]}
                        transform={(values, name) => {
                          return { [name]: values.map((item: { value: string }) => item.value).join(',') };
                        }}
                        fieldProps={{
                          treeCheckStrictly: true,
                          treeCheckable: true,
                          showCheckedStrategy: TreeSelect.SHOW_PARENT,
                          multiple: true,
                          fieldNames: {
                            label: 'name',
                            value: 'id',
                          },
                        }}
                      />
              <Button type="primary" htmlType="submit">
                  查询
            </Button>
  </LightFilter>

© 版本信息

🚑 其他信息

microCloudCode commented 2 weeks ago

+1