Skip to content

Commit

Permalink
fix(form): Password support popoverProps
Browse files Browse the repository at this point in the history
  • Loading branch information
chenshuai2144 committed Nov 15, 2023
1 parent b33ffe2 commit 39aa69b
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions packages/form/src/components/Text/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useMountMergeState } from '@ant-design/pro-utils';
import { Form, Popover, Progress, type InputProps } from 'antd';
import { Form, Popover, PopoverProps, Progress, type InputProps } from 'antd';
import type { InputRef, PasswordProps } from 'antd/lib/input';
import omit from 'omit.js';
import React, { useState } from 'react';
Expand Down Expand Up @@ -44,6 +44,7 @@ export type PasssWordStrengthProps = {
getStatus?: (value?: string) => PasswordStatus;
statusRender?: (status: PasswordStatus) => React.ReactNode;
getPercent?: (value?: string) => number;
popoverProps?: PopoverProps;
};

const PasssWordStrength: React.FC<
Expand Down Expand Up @@ -105,6 +106,7 @@ const PasssWordStrength: React.FC<
width: 240,
}}
placement="right"
{...props.popoverProps}
open={open}
>
{props.children}
Expand All @@ -131,13 +133,19 @@ const Password: React.FC<
getStatus={fieldProps?.getStatus}
statusRender={fieldProps?.statusRender}
getPercent={fieldProps?.getPercent}
popoverProps={fieldProps?.popoverProps}
open={open}
onOpenChange={setOpen}
>
<ProField
valueType="password"
fieldProps={{
...omit(fieldProps, ['getStatus', 'statusRender', 'getPercent']),
...omit(fieldProps, [
'getStatus',
'statusRender',
'getPercent',
'popoverProps',
]),
onBlur: (e: any) => {
fieldProps?.onBlur?.(e);
setOpen(false);
Expand Down

0 comments on commit 39aa69b

Please sign in to comment.