Skip to content

Commit

Permalink
chore(TreeSelect): valueRender prop type (#4495)
Browse files Browse the repository at this point in the history
  • Loading branch information
YSMJ1994 authored Oct 25, 2023
1 parent c6c0b14 commit 4ca767b
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 11 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@
},
"lint-staged": {
"types/**/*.d.ts": [
"npm run tslint --"
"prettier --write",
"git add"
],
"@(src|scripts|docs/*/demo)/**/*.@(js|jsx)": [
"prettier --write"
Expand Down
20 changes: 10 additions & 10 deletions types/select/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ import { data } from '../checkbox';
interface HTMLAttributesWeak extends React.HTMLAttributes<HTMLElement>, InputProps {
defaultValue?: any;
onChange?: any;
onBlur?: any,
onFocus?: any,
onKeyDown?: any,
onBlur?: any;
onFocus?: any;
onKeyDown?: any;
}

type item = {
export type item = {
value?: string | number;
label?: React.ReactNode;
[propName: string]: any;
}
};

export interface AutoCompleteProps extends HTMLAttributesWeak, CommonProps {
/**
Expand Down Expand Up @@ -114,7 +114,7 @@ export interface AutoCompleteProps extends HTMLAttributesWeak, CommonProps {

/**
* 是否跟随滚动
*/
*/
followTrigger?: boolean;

/**
Expand All @@ -125,7 +125,7 @@ export interface AutoCompleteProps extends HTMLAttributesWeak, CommonProps {
/**
* 本地过滤方法,返回一个 Boolean 值确定是否保留
*/
filter?: (key:string, item: any) => boolean;
filter?: (key: string, item: any) => boolean;

/**
* 键盘上下键切换菜单高亮选项的回调
Expand Down Expand Up @@ -295,7 +295,7 @@ export interface SelectProps extends Omit<HTMLAttributesWeak, 'renderPreview'>,

/**
* 是否跟随滚动
*/
*/
followTrigger?: boolean;

/**
Expand All @@ -312,7 +312,7 @@ export interface SelectProps extends Omit<HTMLAttributesWeak, 'renderPreview'>,
/**
* 本地过滤方法,返回一个 Boolean 值确定是否保留
*/
filter?: (key:string, item: any) => boolean;
filter?: (key: string, item: any) => boolean;

/**
* 键盘上下键切换菜单高亮选项的回调
Expand Down Expand Up @@ -462,7 +462,7 @@ export interface SelectProps extends Omit<HTMLAttributesWeak, 'renderPreview'>,
defaultHighlightKey?: string;

/**
* 展开下拉菜单时是否自动焦点到弹层
* 展开下拉菜单时是否自动焦点到弹层
*/
popupAutoFocus?: boolean;
}
Expand Down
9 changes: 9 additions & 0 deletions types/tree-select/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import * as React from 'react';
import CommonProps from '../util';
import { PopupProps } from '../overlay';
import { TreeProps } from '../tree';
import { item } from '../select';

interface HTMLAttributesWeak extends React.HTMLAttributes<HTMLElement> {
defaultValue?: any;
Expand Down Expand Up @@ -224,10 +225,18 @@ export interface TreeSelectProps extends HTMLAttributesWeak, CommonProps {
* 填充到选择框里的值的 key,默认是 value
*/
fillProps?: string;

/**
* 点击文本是否可以勾选
*/
clickToCheck?: boolean;

/**
* 渲染 Select 区域展现内容的方法
* @param {Object} item 渲染项
* @param {Object[]} itemPaths 渲染项在dataSource内的路径
*/
valueRender?: (item: any, itemPaths: item[]) => React.ReactNode;
}

export default class TreeSelect extends React.Component<TreeSelectProps, any> {}

0 comments on commit 4ca767b

Please sign in to comment.