Fix modal can not focus second input bug
This commit is contained in:
@@ -105,24 +105,30 @@ const SignIn = () => {
|
|||||||
twoFactorForm.resetFields()
|
twoFactorForm.resetFields()
|
||||||
void modal.confirm({
|
void modal.confirm({
|
||||||
title: '双因素验证',
|
title: '双因素验证',
|
||||||
getContainer: false,
|
|
||||||
centered: true,
|
centered: true,
|
||||||
|
footer: (_, { OkBtn, CancelBtn }) => (
|
||||||
|
<>
|
||||||
|
<OkBtn />
|
||||||
|
<CancelBtn />
|
||||||
|
</>
|
||||||
|
),
|
||||||
content: (
|
content: (
|
||||||
<>
|
<>
|
||||||
<AntdForm form={twoFactorForm}>
|
<AntdForm
|
||||||
|
form={twoFactorForm}
|
||||||
|
ref={(ref) => {
|
||||||
|
setTimeout(() => {
|
||||||
|
ref?.getFieldInstance('twoFactorCode').focus()
|
||||||
|
}, 50)
|
||||||
|
}}
|
||||||
|
>
|
||||||
<AntdForm.Item
|
<AntdForm.Item
|
||||||
name={'twoFactorCode'}
|
name={'twoFactorCode'}
|
||||||
label={'验证码'}
|
label={'验证码'}
|
||||||
style={{ marginTop: 10 }}
|
style={{ marginTop: 10 }}
|
||||||
rules={[{ required: true, len: 6 }]}
|
rules={[{ required: true, len: 6 }]}
|
||||||
>
|
>
|
||||||
<AntdInput
|
<AntdInput showCount maxLength={6} />
|
||||||
showCount
|
|
||||||
maxLength={6}
|
|
||||||
ref={(input) => {
|
|
||||||
input?.focus()
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</AntdForm.Item>
|
</AntdForm.Item>
|
||||||
</AntdForm>
|
</AntdForm>
|
||||||
</>
|
</>
|
||||||
|
|||||||
@@ -17,23 +17,31 @@ const Mail = () => {
|
|||||||
const handleOnTest = () => {
|
const handleOnTest = () => {
|
||||||
void modal.confirm({
|
void modal.confirm({
|
||||||
title: '发送测试邮件',
|
title: '发送测试邮件',
|
||||||
getContainer: false,
|
|
||||||
centered: true,
|
centered: true,
|
||||||
maskClosable: true,
|
maskClosable: true,
|
||||||
|
footer: (_, { OkBtn, CancelBtn }) => (
|
||||||
|
<>
|
||||||
|
<OkBtn />
|
||||||
|
<CancelBtn />
|
||||||
|
</>
|
||||||
|
),
|
||||||
content: (
|
content: (
|
||||||
<>
|
<>
|
||||||
<AntdForm form={mailSendForm}>
|
<AntdForm
|
||||||
|
form={mailSendForm}
|
||||||
|
ref={(ref) => {
|
||||||
|
setTimeout(() => {
|
||||||
|
ref?.getFieldInstance('to').focus()
|
||||||
|
}, 50)
|
||||||
|
}}
|
||||||
|
>
|
||||||
<AntdForm.Item
|
<AntdForm.Item
|
||||||
name={'to'}
|
name={'to'}
|
||||||
label={'接收人'}
|
label={'接收人'}
|
||||||
style={{ marginTop: 10 }}
|
style={{ marginTop: 10 }}
|
||||||
rules={[{ required: true, type: 'email' }]}
|
rules={[{ required: true, type: 'email' }]}
|
||||||
>
|
>
|
||||||
<AntdInput
|
<AntdInput />
|
||||||
ref={(input) => {
|
|
||||||
input?.focus()
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</AntdForm.Item>
|
</AntdForm.Item>
|
||||||
</AntdForm>
|
</AntdForm>
|
||||||
<AntdTag style={{ whiteSpace: 'normal' }}>
|
<AntdTag style={{ whiteSpace: 'normal' }}>
|
||||||
|
|||||||
@@ -234,6 +234,12 @@ const Base = () => {
|
|||||||
title: '编译',
|
title: '编译',
|
||||||
centered: true,
|
centered: true,
|
||||||
maskClosable: true,
|
maskClosable: true,
|
||||||
|
footer: (_, { OkBtn, CancelBtn }) => (
|
||||||
|
<>
|
||||||
|
<OkBtn />
|
||||||
|
<CancelBtn />
|
||||||
|
</>
|
||||||
|
),
|
||||||
content: (
|
content: (
|
||||||
<>
|
<>
|
||||||
<AntdForm form={compileForm}>
|
<AntdForm form={compileForm}>
|
||||||
@@ -538,11 +544,23 @@ const Base = () => {
|
|||||||
const handleOnAddFile = () => {
|
const handleOnAddFile = () => {
|
||||||
void modal.confirm({
|
void modal.confirm({
|
||||||
title: '新建文件',
|
title: '新建文件',
|
||||||
getContainer: false,
|
|
||||||
centered: true,
|
centered: true,
|
||||||
maskClosable: true,
|
maskClosable: true,
|
||||||
|
footer: (_, { OkBtn, CancelBtn }) => (
|
||||||
|
<>
|
||||||
|
<OkBtn />
|
||||||
|
<CancelBtn />
|
||||||
|
</>
|
||||||
|
),
|
||||||
content: (
|
content: (
|
||||||
<AntdForm form={addFileForm}>
|
<AntdForm
|
||||||
|
form={addFileForm}
|
||||||
|
ref={(ref) => {
|
||||||
|
setTimeout(() => {
|
||||||
|
ref?.getFieldInstance('fileName').focus()
|
||||||
|
}, 50)
|
||||||
|
}}
|
||||||
|
>
|
||||||
<AntdForm.Item
|
<AntdForm.Item
|
||||||
name={'fileName'}
|
name={'fileName'}
|
||||||
label={'文件名'}
|
label={'文件名'}
|
||||||
@@ -568,11 +586,7 @@ const Base = () => {
|
|||||||
})
|
})
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
<AntdInput
|
<AntdInput />
|
||||||
ref={(input) => {
|
|
||||||
input?.focus()
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</AntdForm.Item>
|
</AntdForm.Item>
|
||||||
</AntdForm>
|
</AntdForm>
|
||||||
),
|
),
|
||||||
@@ -721,11 +735,23 @@ const Base = () => {
|
|||||||
renameFileForm.setFieldValue('fileName', fileName)
|
renameFileForm.setFieldValue('fileName', fileName)
|
||||||
void modal.confirm({
|
void modal.confirm({
|
||||||
title: '重命名文件',
|
title: '重命名文件',
|
||||||
getContainer: false,
|
|
||||||
centered: true,
|
centered: true,
|
||||||
maskClosable: true,
|
maskClosable: true,
|
||||||
|
footer: (_, { OkBtn, CancelBtn }) => (
|
||||||
|
<>
|
||||||
|
<OkBtn />
|
||||||
|
<CancelBtn />
|
||||||
|
</>
|
||||||
|
),
|
||||||
content: (
|
content: (
|
||||||
<AntdForm form={renameFileForm}>
|
<AntdForm
|
||||||
|
form={renameFileForm}
|
||||||
|
ref={(ref) => {
|
||||||
|
setTimeout(() => {
|
||||||
|
ref?.getFieldInstance('fileName').focus()
|
||||||
|
}, 50)
|
||||||
|
}}
|
||||||
|
>
|
||||||
<AntdForm.Item
|
<AntdForm.Item
|
||||||
name={'fileName'}
|
name={'fileName'}
|
||||||
label={'新文件名'}
|
label={'新文件名'}
|
||||||
@@ -754,11 +780,7 @@ const Base = () => {
|
|||||||
})
|
})
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
<AntdInput
|
<AntdInput />
|
||||||
ref={(input) => {
|
|
||||||
input?.focus()
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</AntdForm.Item>
|
</AntdForm.Item>
|
||||||
</AntdForm>
|
</AntdForm>
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -399,11 +399,23 @@ const Template = () => {
|
|||||||
const handleOnAddFile = () => {
|
const handleOnAddFile = () => {
|
||||||
void modal.confirm({
|
void modal.confirm({
|
||||||
title: '新建文件',
|
title: '新建文件',
|
||||||
getContainer: false,
|
|
||||||
centered: true,
|
centered: true,
|
||||||
maskClosable: true,
|
maskClosable: true,
|
||||||
|
footer: (_, { OkBtn, CancelBtn }) => (
|
||||||
|
<>
|
||||||
|
<OkBtn />
|
||||||
|
<CancelBtn />
|
||||||
|
</>
|
||||||
|
),
|
||||||
content: (
|
content: (
|
||||||
<AntdForm form={addFileForm}>
|
<AntdForm
|
||||||
|
form={addFileForm}
|
||||||
|
ref={(ref) => {
|
||||||
|
setTimeout(() => {
|
||||||
|
ref?.getFieldInstance('fileName').focus()
|
||||||
|
}, 50)
|
||||||
|
}}
|
||||||
|
>
|
||||||
<AntdForm.Item
|
<AntdForm.Item
|
||||||
name={'fileName'}
|
name={'fileName'}
|
||||||
label={'文件名'}
|
label={'文件名'}
|
||||||
@@ -429,11 +441,7 @@ const Template = () => {
|
|||||||
})
|
})
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
<AntdInput
|
<AntdInput />
|
||||||
ref={(input) => {
|
|
||||||
input?.focus()
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</AntdForm.Item>
|
</AntdForm.Item>
|
||||||
</AntdForm>
|
</AntdForm>
|
||||||
),
|
),
|
||||||
@@ -585,11 +593,23 @@ const Template = () => {
|
|||||||
renameFileForm.setFieldValue('fileName', fileName)
|
renameFileForm.setFieldValue('fileName', fileName)
|
||||||
void modal.confirm({
|
void modal.confirm({
|
||||||
title: '重命名文件',
|
title: '重命名文件',
|
||||||
getContainer: false,
|
|
||||||
centered: true,
|
centered: true,
|
||||||
maskClosable: true,
|
maskClosable: true,
|
||||||
|
footer: (_, { OkBtn, CancelBtn }) => (
|
||||||
|
<>
|
||||||
|
<OkBtn />
|
||||||
|
<CancelBtn />
|
||||||
|
</>
|
||||||
|
),
|
||||||
content: (
|
content: (
|
||||||
<AntdForm form={renameFileForm}>
|
<AntdForm
|
||||||
|
form={renameFileForm}
|
||||||
|
ref={(ref) => {
|
||||||
|
setTimeout(() => {
|
||||||
|
ref?.getFieldInstance('fileName').focus()
|
||||||
|
}, 50)
|
||||||
|
}}
|
||||||
|
>
|
||||||
<AntdForm.Item
|
<AntdForm.Item
|
||||||
name={'fileName'}
|
name={'fileName'}
|
||||||
label={'新文件名'}
|
label={'新文件名'}
|
||||||
@@ -618,11 +638,7 @@ const Template = () => {
|
|||||||
})
|
})
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
<AntdInput
|
<AntdInput />
|
||||||
ref={(input) => {
|
|
||||||
input?.focus()
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</AntdForm.Item>
|
</AntdForm.Item>
|
||||||
</AntdForm>
|
</AntdForm>
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -197,6 +197,12 @@ const Tools = () => {
|
|||||||
title: '审核',
|
title: '审核',
|
||||||
centered: true,
|
centered: true,
|
||||||
maskClosable: true,
|
maskClosable: true,
|
||||||
|
footer: (_, { OkBtn, CancelBtn }) => (
|
||||||
|
<>
|
||||||
|
<OkBtn />
|
||||||
|
<CancelBtn />
|
||||||
|
</>
|
||||||
|
),
|
||||||
content: (
|
content: (
|
||||||
<AntdForm form={form}>
|
<AntdForm form={form}>
|
||||||
<AntdForm.Item
|
<AntdForm.Item
|
||||||
|
|||||||
@@ -336,15 +336,25 @@ const User = () => {
|
|||||||
修改用户 {value.username} 的密码
|
修改用户 {value.username} 的密码
|
||||||
</>
|
</>
|
||||||
),
|
),
|
||||||
getContainer: false,
|
|
||||||
centered: true,
|
centered: true,
|
||||||
maskClosable: true,
|
maskClosable: true,
|
||||||
|
footer: (_, { OkBtn, CancelBtn }) => (
|
||||||
|
<>
|
||||||
|
<OkBtn />
|
||||||
|
<CancelBtn />
|
||||||
|
</>
|
||||||
|
),
|
||||||
content: (
|
content: (
|
||||||
<AntdForm
|
<AntdForm
|
||||||
form={changePasswordForm}
|
form={changePasswordForm}
|
||||||
style={{ marginTop: 20 }}
|
style={{ marginTop: 20 }}
|
||||||
labelCol={{ span: 6 }}
|
labelCol={{ span: 6 }}
|
||||||
wrapperCol={{ span: 18 }}
|
wrapperCol={{ span: 18 }}
|
||||||
|
ref={(ref) => {
|
||||||
|
setTimeout(() => {
|
||||||
|
ref?.getFieldInstance('password').focus()
|
||||||
|
}, 50)
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
<AntdForm.Item name={'id'} label={'ID'} labelAlign={'right'}>
|
<AntdForm.Item name={'id'} label={'ID'} labelAlign={'right'}>
|
||||||
<AntdInput disabled />
|
<AntdInput disabled />
|
||||||
@@ -358,11 +368,7 @@ const User = () => {
|
|||||||
}
|
}
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
<AntdInput.Password
|
<AntdInput.Password />
|
||||||
ref={(input) => {
|
|
||||||
input?.focus()
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</AntdForm.Item>
|
</AntdForm.Item>
|
||||||
<AntdForm.Item
|
<AntdForm.Item
|
||||||
name={'passwordConfirm'}
|
name={'passwordConfirm'}
|
||||||
|
|||||||
@@ -262,12 +262,24 @@ const Tools = () => {
|
|||||||
const handleOnUpgradeTool = (tool: ToolVo) => {
|
const handleOnUpgradeTool = (tool: ToolVo) => {
|
||||||
void modal.confirm({
|
void modal.confirm({
|
||||||
title: '更新工具',
|
title: '更新工具',
|
||||||
getContainer: false,
|
|
||||||
centered: true,
|
centered: true,
|
||||||
maskClosable: true,
|
maskClosable: true,
|
||||||
|
footer: (_, { OkBtn, CancelBtn }) => (
|
||||||
|
<>
|
||||||
|
<OkBtn />
|
||||||
|
<CancelBtn />
|
||||||
|
</>
|
||||||
|
),
|
||||||
content: (
|
content: (
|
||||||
<>
|
<>
|
||||||
<AntdForm form={upgradeForm}>
|
<AntdForm
|
||||||
|
form={upgradeForm}
|
||||||
|
ref={(ref) => {
|
||||||
|
setTimeout(() => {
|
||||||
|
ref?.getFieldInstance('toolId').focus()
|
||||||
|
}, 50)
|
||||||
|
}}
|
||||||
|
>
|
||||||
<AntdForm.Item
|
<AntdForm.Item
|
||||||
initialValue={tool.toolId}
|
initialValue={tool.toolId}
|
||||||
name={'toolId'}
|
name={'toolId'}
|
||||||
@@ -287,14 +299,7 @@ const Tools = () => {
|
|||||||
}
|
}
|
||||||
]}
|
]}
|
||||||
>
|
>
|
||||||
<AntdInput
|
<AntdInput maxLength={10} showCount placeholder={'请输入版本'} />
|
||||||
maxLength={10}
|
|
||||||
showCount
|
|
||||||
placeholder={'请输入版本'}
|
|
||||||
ref={(input) => {
|
|
||||||
input?.focus()
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</AntdForm.Item>
|
</AntdForm.Item>
|
||||||
</AntdForm>
|
</AntdForm>
|
||||||
</>
|
</>
|
||||||
|
|||||||
@@ -99,15 +99,25 @@ const User = () => {
|
|||||||
修改密码
|
修改密码
|
||||||
</>
|
</>
|
||||||
),
|
),
|
||||||
getContainer: false,
|
|
||||||
centered: true,
|
centered: true,
|
||||||
maskClosable: true,
|
maskClosable: true,
|
||||||
|
footer: (_, { OkBtn, CancelBtn }) => (
|
||||||
|
<>
|
||||||
|
<OkBtn />
|
||||||
|
<CancelBtn />
|
||||||
|
</>
|
||||||
|
),
|
||||||
content: (
|
content: (
|
||||||
<AntdForm
|
<AntdForm
|
||||||
form={changePasswordForm}
|
form={changePasswordForm}
|
||||||
style={{ marginTop: 20 }}
|
style={{ marginTop: 20 }}
|
||||||
labelCol={{ span: 6 }}
|
labelCol={{ span: 6 }}
|
||||||
wrapperCol={{ span: 18 }}
|
wrapperCol={{ span: 18 }}
|
||||||
|
ref={(ref) => {
|
||||||
|
setTimeout(() => {
|
||||||
|
ref?.getFieldInstance('originalPassword').focus()
|
||||||
|
}, 50)
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
<AntdForm.Item
|
<AntdForm.Item
|
||||||
name={'originalPassword'}
|
name={'originalPassword'}
|
||||||
@@ -115,12 +125,7 @@ const User = () => {
|
|||||||
labelAlign={'right'}
|
labelAlign={'right'}
|
||||||
rules={[{ required: true, message: '请输入原密码' }]}
|
rules={[{ required: true, message: '请输入原密码' }]}
|
||||||
>
|
>
|
||||||
<AntdInput.Password
|
<AntdInput.Password placeholder={'请输入原密码'} />
|
||||||
placeholder={'请输入原密码'}
|
|
||||||
ref={(input) => {
|
|
||||||
input?.focus()
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</AntdForm.Item>
|
</AntdForm.Item>
|
||||||
<AntdForm.Item
|
<AntdForm.Item
|
||||||
name={'newPassword'}
|
name={'newPassword'}
|
||||||
@@ -217,29 +222,42 @@ const User = () => {
|
|||||||
title: '双因素',
|
title: '双因素',
|
||||||
centered: true,
|
centered: true,
|
||||||
maskClosable: true,
|
maskClosable: true,
|
||||||
|
focusTriggerAfterClose: false,
|
||||||
|
footer: (_, { OkBtn, CancelBtn }) => (
|
||||||
|
<>
|
||||||
|
<OkBtn />
|
||||||
|
<CancelBtn />
|
||||||
|
</>
|
||||||
|
),
|
||||||
content: '确定解除双因素?',
|
content: '确定解除双因素?',
|
||||||
onOk: () => {
|
onOk: () => {
|
||||||
void modal.confirm({
|
void modal.confirm({
|
||||||
title: '解除双因素',
|
title: '解除双因素',
|
||||||
getContainer: false,
|
|
||||||
centered: true,
|
centered: true,
|
||||||
maskClosable: true,
|
maskClosable: true,
|
||||||
|
footer: (_, { OkBtn, CancelBtn }) => (
|
||||||
|
<>
|
||||||
|
<OkBtn />
|
||||||
|
<CancelBtn />
|
||||||
|
</>
|
||||||
|
),
|
||||||
content: (
|
content: (
|
||||||
<>
|
<>
|
||||||
<AntdForm form={twoFactorForm}>
|
<AntdForm
|
||||||
|
form={twoFactorForm}
|
||||||
|
ref={(ref) => {
|
||||||
|
setTimeout(() => {
|
||||||
|
ref?.getFieldInstance('twoFactorCode').focus()
|
||||||
|
}, 50)
|
||||||
|
}}
|
||||||
|
>
|
||||||
<AntdForm.Item
|
<AntdForm.Item
|
||||||
name={'twoFactorCode'}
|
name={'twoFactorCode'}
|
||||||
label={'验证码'}
|
label={'验证码'}
|
||||||
style={{ marginTop: 10 }}
|
style={{ marginTop: 10 }}
|
||||||
rules={[{ required: true, len: 6 }]}
|
rules={[{ required: true, len: 6 }]}
|
||||||
>
|
>
|
||||||
<AntdInput
|
<AntdInput showCount maxLength={6} />
|
||||||
showCount
|
|
||||||
maxLength={6}
|
|
||||||
ref={(input) => {
|
|
||||||
input?.focus()
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</AntdForm.Item>
|
</AntdForm.Item>
|
||||||
</AntdForm>
|
</AntdForm>
|
||||||
</>
|
</>
|
||||||
@@ -289,9 +307,14 @@ const User = () => {
|
|||||||
if (response.success) {
|
if (response.success) {
|
||||||
void modal.confirm({
|
void modal.confirm({
|
||||||
title: '绑定双因素',
|
title: '绑定双因素',
|
||||||
getContainer: false,
|
|
||||||
centered: true,
|
centered: true,
|
||||||
maskClosable: true,
|
maskClosable: true,
|
||||||
|
footer: (_, { OkBtn, CancelBtn }) => (
|
||||||
|
<>
|
||||||
|
<OkBtn />
|
||||||
|
<CancelBtn />
|
||||||
|
</>
|
||||||
|
),
|
||||||
content: (
|
content: (
|
||||||
<>
|
<>
|
||||||
<AntdImage
|
<AntdImage
|
||||||
@@ -299,20 +322,21 @@ const User = () => {
|
|||||||
alt={'Two-factor'}
|
alt={'Two-factor'}
|
||||||
preview={false}
|
preview={false}
|
||||||
/>
|
/>
|
||||||
<AntdForm form={twoFactorForm}>
|
<AntdForm
|
||||||
|
form={twoFactorForm}
|
||||||
|
ref={(ref) => {
|
||||||
|
setTimeout(() => {
|
||||||
|
ref?.getFieldInstance('twoFactorCode').focus()
|
||||||
|
}, 50)
|
||||||
|
}}
|
||||||
|
>
|
||||||
<AntdForm.Item
|
<AntdForm.Item
|
||||||
name={'twoFactorCode'}
|
name={'twoFactorCode'}
|
||||||
label={'验证码'}
|
label={'验证码'}
|
||||||
style={{ marginTop: 10, marginRight: 30 }}
|
style={{ marginTop: 10, marginRight: 30 }}
|
||||||
rules={[{ required: true, len: 6 }]}
|
rules={[{ required: true, len: 6 }]}
|
||||||
>
|
>
|
||||||
<AntdInput
|
<AntdInput showCount maxLength={6} />
|
||||||
showCount
|
|
||||||
maxLength={6}
|
|
||||||
ref={(input) => {
|
|
||||||
input?.focus()
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</AntdForm.Item>
|
</AntdForm.Item>
|
||||||
</AntdForm>
|
</AntdForm>
|
||||||
</>
|
</>
|
||||||
|
|||||||
Reference in New Issue
Block a user