Skip to content

Commit

Permalink
fix(form): PasswordStrength support morse options
Browse files Browse the repository at this point in the history
close #8074
  • Loading branch information
chenshuai2144 committed Feb 1, 2024
1 parent 85de8a2 commit 3ab9f11
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ export default () => {
prefix: <LockOutlined className={'prefixIcon'} />,
strengthText:
'Password should contain numbers, letters and special characters, at least 8 characters long.',

statusRender: (value) => {
const getStatus = () => {
if (value && value.length > 12) {
Expand Down
54 changes: 28 additions & 26 deletions packages/form/src/components/Text/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ const PassWordStrength: React.FC<
overlayStyle={{
width: 240,
}}
placement="right"
placement="rightTop"
{...props.popoverProps}
open={open}
>
Expand Down Expand Up @@ -117,31 +117,33 @@ const Password: React.FC<
open={open}
onOpenChange={setOpen}
>
<ProField
valueType="password"
fieldProps={{
...omit(fieldProps, [
'statusRender',
'popoverProps',
'strengthText',
]),
onBlur: (e: any) => {
fieldProps?.onBlur?.(e);
setOpen(false);
},
onClick: (e: any) => {
fieldProps?.onClick?.(e);
setOpen(true);
},
}}
proFieldProps={proFieldProps}
filedConfig={
{
valueType,
} as const
}
{...rest}
/>
<div>
<ProField
valueType="password"
fieldProps={{
...omit(fieldProps, [
'statusRender',
'popoverProps',
'strengthText',
]),
onBlur: (e: any) => {
fieldProps?.onBlur?.(e);
setOpen(false);
},
onClick: (e: any) => {
fieldProps?.onClick?.(e);
setOpen(true);
},
}}
proFieldProps={proFieldProps}
filedConfig={
{
valueType,
} as const
}
{...rest}
/>
</div>
</PassWordStrength>
);
}
Expand Down
5 changes: 3 additions & 2 deletions tests/field/__snapshots__/demo.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -1589,10 +1589,11 @@ exports[`field demos > 📸 renders ./packages/field/src/demos/base_test.tsx cor
class="ant-descriptions-item-content"
>
<span
class="ant-input-affix-wrapper ant-input-outlined"
class="ant-input-affix-wrapper ant-input-disabled ant-input-affix-wrapper-disabled ant-input-outlined"
>
<input
class="ant-input"
class="ant-input ant-input-disabled"
disabled=""
placeholder="请输入"
type="text"
value=""
Expand Down

0 comments on commit 3ab9f11

Please sign in to comment.