-
Notifications
You must be signed in to change notification settings - Fork 51
feat: enhance allowClear prop to support disabled #160
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
base: master
Are you sure you want to change the base?
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 |
|---|---|---|
|
|
@@ -33,7 +33,7 @@ export interface CommonInputProps { | |
| prefix?: CSSProperties; | ||
| suffix?: CSSProperties; | ||
| }; | ||
| allowClear?: boolean | { clearIcon?: ReactNode }; | ||
| allowClear?: boolean | { disabled?: boolean; clearIcon?: ReactNode }; | ||
|
Member
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. antd 里有没有类似的属性?
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. antd 里是直接 import 的这个类型复用了
Member
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. 我意思是 antd 里是否有 config 里带有 enabled or disabled 的属性可以参考一下。免得未来这个名字出现多种情况
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. 搜索了一下,大部分使用的是 disabled,比如 useClosable: interface ClosableCollection {
closable?: ClosableType;
closeIcon?: ReactNode;
disabled?: boolean;
}比如 WaveConfig: export interface WaveConfig {
disabled?: boolean;
showEffect?: ShowWaveEffect;
}而 enabled 只有一处使用: export interface MaskConfig {
enabled?: boolean;
blur?: boolean;
closable?: boolean;
} |
||
| } | ||
|
|
||
| type DataAttr = Record<`data-${string}`, string>; | ||
|
|
@@ -86,7 +86,8 @@ export interface CountConfig { | |
| } | ||
|
|
||
| export interface InputProps | ||
| extends CommonInputProps, | ||
| extends | ||
| CommonInputProps, | ||
| Omit< | ||
| InputHTMLAttributes<HTMLInputElement>, | ||
| 'size' | 'prefix' | 'type' | 'value' | ||
|
|
||
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.
null 也是 object
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.
外层的
if (allowClear)已经确保不为null了,因此这里就没有再判断了