-
-
Notifications
You must be signed in to change notification settings - Fork 490
feat: add inputProps prop to pass props to internal input #1221
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -21,6 +21,8 @@ export interface InputProps { | |||||||||||||||||||
| syncWidth?: boolean; | ||||||||||||||||||||
| /** autoComplete for input */ | ||||||||||||||||||||
| autoComplete?: string; | ||||||||||||||||||||
| /** Props passed to the internal input element */ | ||||||||||||||||||||
| inputProps?: React.InputHTMLAttributes<HTMLInputElement>; | ||||||||||||||||||||
| } | ||||||||||||||||||||
|
|
||||||||||||||||||||
| const Input = React.forwardRef<HTMLInputElement, InputProps>((props, ref) => { | ||||||||||||||||||||
|
|
@@ -33,6 +35,7 @@ const Input = React.forwardRef<HTMLInputElement, InputProps>((props, ref) => { | |||||||||||||||||||
| value, | ||||||||||||||||||||
| className, | ||||||||||||||||||||
| autoComplete, | ||||||||||||||||||||
| inputProps, | ||||||||||||||||||||
| ...restProps | ||||||||||||||||||||
| } = props; | ||||||||||||||||||||
| const { | ||||||||||||||||||||
|
|
@@ -164,6 +167,7 @@ const Input = React.forwardRef<HTMLInputElement, InputProps>((props, ref) => { | |||||||||||||||||||
| id, | ||||||||||||||||||||
| type: mode === 'combobox' ? 'text' : 'search', | ||||||||||||||||||||
| ...restProps, | ||||||||||||||||||||
| ...inputProps, | ||||||||||||||||||||
| ref: inputRef as React.Ref<HTMLInputElement>, | ||||||||||||||||||||
| style: { | ||||||||||||||||||||
| ...styles?.input, | ||||||||||||||||||||
|
Comment on lines
+170
to
173
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The
Suggested change
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 暂时不考虑这个style问题,应该统一由styles处理 |
||||||||||||||||||||
|
|
||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -48,6 +48,8 @@ export interface SelectInputProps extends Omit<React.HTMLAttributes<HTMLDivEleme | |
| focused?: boolean; | ||
| components: ComponentsConfig; | ||
| children?: React.ReactElement; | ||
| /** Props passed to the internal input element */ | ||
| inputProps?: React.InputHTMLAttributes<HTMLInputElement>; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 已经修改了,使用DEFAULT_OMIT_PROPS 排除了 |
||
| } | ||
|
|
||
| const DEFAULT_OMIT_PROPS = [ | ||
|
|
@@ -65,6 +67,7 @@ const DEFAULT_OMIT_PROPS = [ | |
| 'activeValue', | ||
| 'onSelectorRemove', | ||
| 'focused', | ||
| 'inputProps', | ||
| ] as const; | ||
|
|
||
| export default React.forwardRef<SelectInputRef, SelectInputProps>(function SelectInput( | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
已经有 components 可以自定义子组件,inputProps 有点多余了。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
可以components.input = Input 。我去回复issue吧