fix(web): when the type of the loop variable is number, value uses InputNumber

This commit is contained in:
zhaoying
2026-01-20 16:10:49 +08:00
parent 91d3758691
commit b5b1a98bc4

View File

@@ -1,6 +1,6 @@
import { type FC } from 'react' import { type FC } from 'react'
import { useTranslation } from 'react-i18next'; import { useTranslation } from 'react-i18next';
import { Form, Select, Input, Button } from 'antd' import { Form, Select, Input, Button, InputNumber } from 'antd'
import VariableSelect from '../VariableSelect' import VariableSelect from '../VariableSelect'
import type { Suggestion } from '../../Editor/plugin/AutocompletePlugin' import type { Suggestion } from '../../Editor/plugin/AutocompletePlugin'
@@ -93,6 +93,7 @@ const CycleVarsList: FC<CycleVarsListProps> = ({
</Button> </Button>
</div> </div>
{fields.map(({ key, name }, index) => { {fields.map(({ key, name }, index) => {
const currentType = value?.[index]?.type;
const currentInputType = value?.[index]?.input_type; const currentInputType = value?.[index]?.input_type;
return ( return (
@@ -131,7 +132,8 @@ const CycleVarsList: FC<CycleVarsListProps> = ({
</div> </div>
<Form.Item name={[name, 'value']} noStyle> <Form.Item name={[name, 'value']} noStyle>
{currentInputType === 'variable' ? ( {currentInputType === 'variable'
? (
<VariableSelect <VariableSelect
placeholder={t('common.pleaseSelect')} placeholder={t('common.pleaseSelect')}
options={availableOptions.filter(option => { options={availableOptions.filter(option => {
@@ -143,7 +145,15 @@ const CycleVarsList: FC<CycleVarsListProps> = ({
variant="borderless" variant="borderless"
size="small" size="small"
/> />
) : ( )
: currentType === 'number'
? <InputNumber
placeholder={t('common.pleaseEnter')}
variant="borderless"
className="rb:w-full! rb:my-1!"
onChange={(value) => form.setFieldValue([name, 'value'], value)}
/>
: (
<Input.TextArea <Input.TextArea
placeholder={t('common.pleaseEnter')} placeholder={t('common.pleaseEnter')}
rows={3} rows={3}