Skip to content

🐛[BUG]BetaSchemaForm组件 使用查询表单 当第一列数据设置colSize=4时,设置的defaultColsNumber不生效,永远默认就只展示了一行数据 #9293

@DJGDragon

Description

@DJGDragon

提问前先看看:

https://github.com/ryanhanwu/How-To-Ask-Questions-The-Smart-Way/blob/main/README-zh_CN.md

🐛 bug 描述

BetaSchemaForm组件 使用查询表单 当第一列数据设置colSize=4时(只要是大于内置的每行的列数都有问题),设置的defaultColsNumber不生效,永远默认就只展示了一行数据

📷 复现步骤

import type {
ProFormColumnsType,
ProFormLayoutType,
} from "@ant-design/pro-components";
import { BetaSchemaForm, ProFormSelect } from "@ant-design/pro-components";
import { Alert, DatePicker, Space } from "antd";
import dayjs from "dayjs";
import { useState } from "react";

const columns = new Array(10).fill(1).map((, index) => {
return {
id: (Date.now() + index).toString(),
title: 活动名称${index},
colSize: index === 0 ? 1 : 1,
};
});
const columns1 = new Array(10).fill(1).map((
, index) => {
return {
id: (Date.now() + index).toString(),
title: 活动名称${index},
colSize: index === 0 ? 4 : 1,
};
});
const columns2 = new Array(10).fill(1).map((_, index) => {
return {
id: (Date.now() + index).toString(),
title: 活动名称${index},
colSize: index === 1 ? 4 : 1,
};
});
export default () => {
return (
<>
!!! 第一行colSize=1 defaultColsNumber=10
<BetaSchemaForm
layoutType={"QueryFilter"}
defaultColsNumber={10}
columns={columns}
autoFocusFirstInput={false}
/>
!!! 第一行colSize=4 defaultColsNumber=10 显示错误 只能默认展开一行
<BetaSchemaForm
layoutType={"QueryFilter"}
defaultColsNumber={10}
columns={columns1}
autoFocusFirstInput={false}
/>
!!! 第二行colSize=4 defaultColsNumber=10 能正确显示
<BetaSchemaForm
layoutType={"QueryFilter"}
defaultColsNumber={10}
columns={columns2}
autoFocusFirstInput={false}
/>
</>
);
};

设置的三种方式 colSize只要第一列数据大于了设置的每行的列数 就只能显示默认展示一行 第二列数据设置colSize就是正确的

🏞 期望结果

当设置第一行为colSize>1时,设置的defaultColsNumber依然生效
有需求就是查询表单第一项需要整行展示,这个bug就无法实现这个需求

💻 复现代码

defaultColsNumber

© 版本信息

🚑 其他信息

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions