Я использую fields.push({ no: idx + 1, id: item.name })
Код
XxxAddOrEditForm. js
<Form>
.
.
<FieldArray>
name="availableShops"
component={MultiSelectFields}
items={availableShops}
preItems={xxxShops}
</FieldArray>
.
.
</Form>
MultiSelectFields. js
const MultiSelectFields = props => {
useEffect(() => {
await displaySelectedFields()
prepareAvailableOptions()
}, [])
const prepareAvailableOptions = () => {
setCurrentOptions(items)
if (props.preItems.length > 0) {
props.preItems.forEach(preItem => items.push(preItem))
}
setOriginalOptions(items)
}
const displaySelectedFields = () => {
props.preItems.map((item, idx) => {
fields.push({ no: idx + 1, id: item.name })
})
}
.
.
.
return (
<>
.
.
{fields.map((field, idx) => (
<Row>
<Col span={12}>
<Field
name={`${field}.no`}
label="No."
component={InputField}
disabled
/>
</Col>
<Col span={2}>
<Field
name={`${field}.id`}
label="Name"
component={SelectField}
input={{ onChange: selectShop(currentOptions) }}
validate={[VALIDATION.required]}
items={getAvailableFiltered(idx, currentOptions)}
/>
</Col>
<Col>
<Button>-</Button>
</Col>
</Row>
<Row>
.
.
</Row>
.
.
}
.
.
</>
)
}
====
В интерфейсе пользователя. ..
Нет. поле может отображаться, но поле Имя (имя id в коде)
Это состояние с избыточностью
идентификатор появляется в состоянии избыточности Почему идентификатор также не отображается в форме избыточности (поле Имя)?