Skip to content

Commit

Permalink
feat: 类型补充
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangyu committed Jun 30, 2022
1 parent fc22bd2 commit 19ce0cf
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion site/docs/zh-CN/select.md
Original file line number Diff line number Diff line change
Expand Up @@ -690,7 +690,7 @@ render(){
| dropdownStyle | 下拉菜单的 style 属性 | Object | - |
| errorMessage | 错误提示文案 | String/ReactNode | '超过选项上限' |
| extraOptions | 额外的列表项 | String/ReactNode | - |
| filterOption | 是否根据输入项进行筛选。当其为一个函数时,会接收 `inputValue` `option` 两个参数,当 `option` 符合筛选条件时,应返回 `true`,反之则返回 `false`| Boolean \| (inputValue, option) => Void | true |
| filterOption | 是否根据输入项进行筛选。当其为一个函数时,会接收 `inputValue` `option` 两个参数,当 `option` 符合筛选条件时,应返回 `true`,反之则返回 `false`| Boolean \| (inputValue, option) => Boolean | true |
| getPopupContainer | 菜单渲染父节点。默认渲染到 body 上,如果你遇到菜单滚动定位问题,试试修改为滚动的区域,并相对其定位。[示例](https://codesandbox.io/s/4j168r7jw0) | (triggerNode) => HTMLElement | () => document.body |
| labelClear | 多选模式下开启label删除功能 | Boolean | false |
| labelInValue | 是否把每个选项的 label 包装到 value 中,会把 Select 的 value 类型从 `string` 变为 `{key: String, label: ReactNode , title : String }` 的格式 | Boolean | false |
Expand Down
12 changes: 11 additions & 1 deletion source/components/Select/Select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,16 @@ import { LocaleContext } from '../Config/Locale/Context';
import { LocaleProperties } from '../Locale';
const noop = () => {};

interface OptionProps {
disabled?: boolean;
value?: string | number;
title?: string;
label?: React.ReactNode;
children?: React.ReactNode;
className?: string;
style?: React.CSSProperties;
}

interface SelectProps {
virtual?: boolean;
allowClear?: boolean;
Expand All @@ -32,7 +42,7 @@ interface SelectProps {
dropdownStyle?: React.CSSProperties;
errorMessage?: string | React.ReactNode;
extraOptions?: string | React.ReactNode;
filterOption?: boolean | ((inputValue, option) => boolean);
filterOption?: boolean | ((inputValue: string, option: React.ReactElement<OptionProps>) => boolean);
getPopupContainer?: (triggerNode: HTMLElement) => HTMLElement;
labelClear?: boolean;
labelInValue?: boolean;
Expand Down

0 comments on commit 19ce0cf

Please sign in to comment.