@@ -12,6 +12,7 @@ export interface EditableInputProps extends Omit<React.InputHTMLAttributes<HTMLI
1212 placement ?: 'top' | 'left' | 'bottom' | 'right' ;
1313 inputStyle ?: React . CSSProperties ;
1414 onChange ?: ( evn : React . ChangeEvent < HTMLInputElement > , value : string | number ) => void ;
15+ renderInput ?: ( props : React . InputHTMLAttributes < HTMLInputElement > , ref : React . Ref < HTMLInputElement > ) => React . ReactNode ;
1516}
1617
1718const EditableInput = React . forwardRef < HTMLInputElement , EditableInputProps > ( ( props , ref ) => {
@@ -26,6 +27,7 @@ const EditableInput = React.forwardRef<HTMLInputElement, EditableInputProps>((pr
2627 inputStyle,
2728 onChange,
2829 onBlur,
30+ renderInput,
2931 ...other
3032 } = props ;
3133 const [ value , setValue ] = useState < string | number | undefined > ( initValue ) ;
@@ -90,18 +92,19 @@ const EditableInput = React.forwardRef<HTMLInputElement, EditableInputProps>((pr
9092 boxShadow : 'var(--editable-input-box-shadow)' ,
9193 ...inputStyle ,
9294 } as React . CSSProperties ;
95+
96+ const inputProps : React . InputHTMLAttributes < HTMLInputElement > = {
97+ value,
98+ onChange : handleChange ,
99+ onBlur : handleBlur ,
100+ autoComplete : 'off' ,
101+ onFocus : ( ) => ( isFocus . current = true ) ,
102+ ...other ,
103+ style : editableStyle ,
104+ } ;
93105 return (
94106 < div className = { [ prefixCls , className || '' ] . filter ( Boolean ) . join ( ' ' ) } style = { wrapperStyle } >
95- < input
96- ref = { ref }
97- value = { value }
98- onChange = { handleChange }
99- onBlur = { handleBlur }
100- autoComplete = "off"
101- onFocus = { ( ) => ( isFocus . current = true ) }
102- { ...other }
103- style = { editableStyle }
104- />
107+ { renderInput ? renderInput ( inputProps , ref ) : < input ref = { ref } { ...inputProps } /> }
105108 { label && (
106109 < span
107110 style = { {
0 commit comments