Fix modal can not focus second input bug
This commit is contained in:
@@ -17,23 +17,31 @@ const Mail = () => {
|
||||
const handleOnTest = () => {
|
||||
void modal.confirm({
|
||||
title: '发送测试邮件',
|
||||
getContainer: false,
|
||||
centered: true,
|
||||
maskClosable: true,
|
||||
footer: (_, { OkBtn, CancelBtn }) => (
|
||||
<>
|
||||
<OkBtn />
|
||||
<CancelBtn />
|
||||
</>
|
||||
),
|
||||
content: (
|
||||
<>
|
||||
<AntdForm form={mailSendForm}>
|
||||
<AntdForm
|
||||
form={mailSendForm}
|
||||
ref={(ref) => {
|
||||
setTimeout(() => {
|
||||
ref?.getFieldInstance('to').focus()
|
||||
}, 50)
|
||||
}}
|
||||
>
|
||||
<AntdForm.Item
|
||||
name={'to'}
|
||||
label={'接收人'}
|
||||
style={{ marginTop: 10 }}
|
||||
rules={[{ required: true, type: 'email' }]}
|
||||
>
|
||||
<AntdInput
|
||||
ref={(input) => {
|
||||
input?.focus()
|
||||
}}
|
||||
/>
|
||||
<AntdInput />
|
||||
</AntdForm.Item>
|
||||
</AntdForm>
|
||||
<AntdTag style={{ whiteSpace: 'normal' }}>
|
||||
|
||||
@@ -234,6 +234,12 @@ const Base = () => {
|
||||
title: '编译',
|
||||
centered: true,
|
||||
maskClosable: true,
|
||||
footer: (_, { OkBtn, CancelBtn }) => (
|
||||
<>
|
||||
<OkBtn />
|
||||
<CancelBtn />
|
||||
</>
|
||||
),
|
||||
content: (
|
||||
<>
|
||||
<AntdForm form={compileForm}>
|
||||
@@ -538,11 +544,23 @@ const Base = () => {
|
||||
const handleOnAddFile = () => {
|
||||
void modal.confirm({
|
||||
title: '新建文件',
|
||||
getContainer: false,
|
||||
centered: true,
|
||||
maskClosable: true,
|
||||
footer: (_, { OkBtn, CancelBtn }) => (
|
||||
<>
|
||||
<OkBtn />
|
||||
<CancelBtn />
|
||||
</>
|
||||
),
|
||||
content: (
|
||||
<AntdForm form={addFileForm}>
|
||||
<AntdForm
|
||||
form={addFileForm}
|
||||
ref={(ref) => {
|
||||
setTimeout(() => {
|
||||
ref?.getFieldInstance('fileName').focus()
|
||||
}, 50)
|
||||
}}
|
||||
>
|
||||
<AntdForm.Item
|
||||
name={'fileName'}
|
||||
label={'文件名'}
|
||||
@@ -568,11 +586,7 @@ const Base = () => {
|
||||
})
|
||||
]}
|
||||
>
|
||||
<AntdInput
|
||||
ref={(input) => {
|
||||
input?.focus()
|
||||
}}
|
||||
/>
|
||||
<AntdInput />
|
||||
</AntdForm.Item>
|
||||
</AntdForm>
|
||||
),
|
||||
@@ -721,11 +735,23 @@ const Base = () => {
|
||||
renameFileForm.setFieldValue('fileName', fileName)
|
||||
void modal.confirm({
|
||||
title: '重命名文件',
|
||||
getContainer: false,
|
||||
centered: true,
|
||||
maskClosable: true,
|
||||
footer: (_, { OkBtn, CancelBtn }) => (
|
||||
<>
|
||||
<OkBtn />
|
||||
<CancelBtn />
|
||||
</>
|
||||
),
|
||||
content: (
|
||||
<AntdForm form={renameFileForm}>
|
||||
<AntdForm
|
||||
form={renameFileForm}
|
||||
ref={(ref) => {
|
||||
setTimeout(() => {
|
||||
ref?.getFieldInstance('fileName').focus()
|
||||
}, 50)
|
||||
}}
|
||||
>
|
||||
<AntdForm.Item
|
||||
name={'fileName'}
|
||||
label={'新文件名'}
|
||||
@@ -754,11 +780,7 @@ const Base = () => {
|
||||
})
|
||||
]}
|
||||
>
|
||||
<AntdInput
|
||||
ref={(input) => {
|
||||
input?.focus()
|
||||
}}
|
||||
/>
|
||||
<AntdInput />
|
||||
</AntdForm.Item>
|
||||
</AntdForm>
|
||||
),
|
||||
|
||||
@@ -399,11 +399,23 @@ const Template = () => {
|
||||
const handleOnAddFile = () => {
|
||||
void modal.confirm({
|
||||
title: '新建文件',
|
||||
getContainer: false,
|
||||
centered: true,
|
||||
maskClosable: true,
|
||||
footer: (_, { OkBtn, CancelBtn }) => (
|
||||
<>
|
||||
<OkBtn />
|
||||
<CancelBtn />
|
||||
</>
|
||||
),
|
||||
content: (
|
||||
<AntdForm form={addFileForm}>
|
||||
<AntdForm
|
||||
form={addFileForm}
|
||||
ref={(ref) => {
|
||||
setTimeout(() => {
|
||||
ref?.getFieldInstance('fileName').focus()
|
||||
}, 50)
|
||||
}}
|
||||
>
|
||||
<AntdForm.Item
|
||||
name={'fileName'}
|
||||
label={'文件名'}
|
||||
@@ -429,11 +441,7 @@ const Template = () => {
|
||||
})
|
||||
]}
|
||||
>
|
||||
<AntdInput
|
||||
ref={(input) => {
|
||||
input?.focus()
|
||||
}}
|
||||
/>
|
||||
<AntdInput />
|
||||
</AntdForm.Item>
|
||||
</AntdForm>
|
||||
),
|
||||
@@ -585,11 +593,23 @@ const Template = () => {
|
||||
renameFileForm.setFieldValue('fileName', fileName)
|
||||
void modal.confirm({
|
||||
title: '重命名文件',
|
||||
getContainer: false,
|
||||
centered: true,
|
||||
maskClosable: true,
|
||||
footer: (_, { OkBtn, CancelBtn }) => (
|
||||
<>
|
||||
<OkBtn />
|
||||
<CancelBtn />
|
||||
</>
|
||||
),
|
||||
content: (
|
||||
<AntdForm form={renameFileForm}>
|
||||
<AntdForm
|
||||
form={renameFileForm}
|
||||
ref={(ref) => {
|
||||
setTimeout(() => {
|
||||
ref?.getFieldInstance('fileName').focus()
|
||||
}, 50)
|
||||
}}
|
||||
>
|
||||
<AntdForm.Item
|
||||
name={'fileName'}
|
||||
label={'新文件名'}
|
||||
@@ -618,11 +638,7 @@ const Template = () => {
|
||||
})
|
||||
]}
|
||||
>
|
||||
<AntdInput
|
||||
ref={(input) => {
|
||||
input?.focus()
|
||||
}}
|
||||
/>
|
||||
<AntdInput />
|
||||
</AntdForm.Item>
|
||||
</AntdForm>
|
||||
),
|
||||
|
||||
@@ -197,6 +197,12 @@ const Tools = () => {
|
||||
title: '审核',
|
||||
centered: true,
|
||||
maskClosable: true,
|
||||
footer: (_, { OkBtn, CancelBtn }) => (
|
||||
<>
|
||||
<OkBtn />
|
||||
<CancelBtn />
|
||||
</>
|
||||
),
|
||||
content: (
|
||||
<AntdForm form={form}>
|
||||
<AntdForm.Item
|
||||
|
||||
@@ -336,15 +336,25 @@ const User = () => {
|
||||
修改用户 {value.username} 的密码
|
||||
</>
|
||||
),
|
||||
getContainer: false,
|
||||
centered: true,
|
||||
maskClosable: true,
|
||||
footer: (_, { OkBtn, CancelBtn }) => (
|
||||
<>
|
||||
<OkBtn />
|
||||
<CancelBtn />
|
||||
</>
|
||||
),
|
||||
content: (
|
||||
<AntdForm
|
||||
form={changePasswordForm}
|
||||
style={{ marginTop: 20 }}
|
||||
labelCol={{ span: 6 }}
|
||||
wrapperCol={{ span: 18 }}
|
||||
ref={(ref) => {
|
||||
setTimeout(() => {
|
||||
ref?.getFieldInstance('password').focus()
|
||||
}, 50)
|
||||
}}
|
||||
>
|
||||
<AntdForm.Item name={'id'} label={'ID'} labelAlign={'right'}>
|
||||
<AntdInput disabled />
|
||||
@@ -358,11 +368,7 @@ const User = () => {
|
||||
}
|
||||
]}
|
||||
>
|
||||
<AntdInput.Password
|
||||
ref={(input) => {
|
||||
input?.focus()
|
||||
}}
|
||||
/>
|
||||
<AntdInput.Password />
|
||||
</AntdForm.Item>
|
||||
<AntdForm.Item
|
||||
name={'passwordConfirm'}
|
||||
|
||||
Reference in New Issue
Block a user