pro-components
pro-components copied to clipboard
🐛[BUG] ProFormList在单个新record时,ProFormSelect 的 transform不会触发
trafficstars
🐛 bug 描述
ProFormList在单个新record时,ProFormSelect 的 transform不会触发 反之,多个新record时,transform正常触发
📷 复现步骤
transform={(value: string[]) => {
console.log('transform')
console.log(value)
return {prodLine: value[0]}
}}
在创建新时,尝试只新增一个record,然后submit 然后尝试新增多个record,然后submit
🏞 期望结果
无论新增多少record都好,transform在submit时候都要正常触发
💻 复现代码
<ProFormList
name={'plMaps'}
min={1}
>
{(_meta, currIndex, _action, _count) => {
return (
<ProFormGroup key={'plMapList'} autoFocus>
<ProFormSelect
width={'md'}
mode={'tags'}
name={'prodLine'}
options={initProdLine}
label={'Production Line'}
allowClear={false}
placeholder={'Select or Input New PL'}
normalize={(tags: string[]) => tags.map(str => str.toUpperCase())}
fieldProps={{
fetchDataOnSearch: false,
showSearch: true,
maxCount: 1,
tagRender: (props) => <Tag color={'blue-inverse'}>{props.label}</Tag>
}}
transform={(value: string[]) => {
console.log('transform')
console.log(value)
return {prodLine: value[0]}
}}
rules={[
{required: true, message: ''}
]}
/>
</ProFormGroup>
)
}}
</ProFormList>
© 版本信息
"antd": "^5.25.0", "@ant-design/pro-components": "^2.8.2",