mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-24 11:10:01 +08:00
add icon prop in .d.ts
This commit is contained in:
parent
9578083b92
commit
a5e2020908
@ -49,7 +49,7 @@ Almost anything can be represented in a tree structure. Examples include directo
|
||||
| -------- | ----------- | ---- | ------- |
|
||||
| disableCheckbox | Disables the checkbox of the treeNode | boolean | false |
|
||||
| disabled | Disables the treeNode | boolean | false |
|
||||
| icon | customize icon. When you pass component, whose render will receive full TreeNode props as component props | element/Function(props):ReactNode | - |
|
||||
| icon | customize icon. When you pass component, whose render will receive full TreeNode props as component props | ReactNode/Function(props):ReactNode | - |
|
||||
| isLeaf | Determines if this is a leaf node(effective when `loadData` is specified) | boolean | false |
|
||||
| key | Used with (default)ExpandedKeys / (default)CheckedKeys / (default)SelectedKeys. P.S.: It must be unique in all of treeNodes of the tree! | string | internal calculated position of treeNode |
|
||||
| selectable | Set whether the treeNode can be selected | boolean | true |
|
||||
|
@ -2,12 +2,32 @@ import * as React from 'react';
|
||||
import RcTree, { TreeNode } from 'rc-tree';
|
||||
import animation from '../_util/openAnimation';
|
||||
|
||||
export interface AntdTreeNodeAttribute {
|
||||
eventKey: string;
|
||||
prefixCls: string;
|
||||
className: string;
|
||||
expanded: boolean;
|
||||
selected: boolean;
|
||||
checked: boolean;
|
||||
halfChecked: boolean;
|
||||
children: React.ReactNode;
|
||||
title: React.ReactNode;
|
||||
pos: string;
|
||||
dragOver: boolean;
|
||||
dragOverGapTop: boolean;
|
||||
dragOverGapBottom: boolean;
|
||||
isLeaf: boolean;
|
||||
selectable: boolean;
|
||||
disabled: boolean;
|
||||
disableCheckbox: boolean;
|
||||
}
|
||||
export interface AntTreeNodeProps {
|
||||
disabled?: boolean;
|
||||
disableCheckbox?: boolean;
|
||||
title?: string | React.ReactNode;
|
||||
key?: string;
|
||||
isLeaf?: boolean;
|
||||
icon?: (treeNode: AntdTreeNodeAttribute) => React.ReactNode | React.ReactNode;
|
||||
children?: React.ReactNode;
|
||||
}
|
||||
|
||||
@ -17,9 +37,9 @@ export interface AntTreeNodeEvent {
|
||||
event: 'check' | 'select';
|
||||
node: AntTreeNode;
|
||||
checked?: boolean;
|
||||
checkedNodes?: Array<AntTreeNode>;
|
||||
checkedNodes?: AntTreeNode[];
|
||||
selected?: boolean;
|
||||
selectedNodes?: Array<AntTreeNode>;
|
||||
selectedNodes?: AntTreeNode[];
|
||||
}
|
||||
|
||||
export interface AntTreeNodeMouseEvent {
|
||||
@ -41,23 +61,26 @@ export interface TreeProps {
|
||||
/** 默认展开所有树节点 */
|
||||
defaultExpandAll?: boolean;
|
||||
/** 默认展开指定的树节点 */
|
||||
defaultExpandedKeys?: Array<string>;
|
||||
defaultExpandedKeys?: string[];
|
||||
/** (受控)展开指定的树节点 */
|
||||
expandedKeys?: Array<string>;
|
||||
expandedKeys?: string[];
|
||||
/** (受控)选中复选框的树节点 */
|
||||
checkedKeys?: Array<string> | { checked: Array<string>, halfChecked: Array<string> };
|
||||
checkedKeys?: string[] | { checked: string[]; halfChecked: string[] };
|
||||
/** 默认选中复选框的树节点 */
|
||||
defaultCheckedKeys?: Array<string>;
|
||||
defaultCheckedKeys?: string[];
|
||||
/** (受控)设置选中的树节点 */
|
||||
selectedKeys?: Array<string>;
|
||||
selectedKeys?: string[];
|
||||
/** 默认选中的树节点 */
|
||||
defaultSelectedKeys?: Array<string>;
|
||||
defaultSelectedKeys?: string[];
|
||||
/** 展开/收起节点时触发 */
|
||||
onExpand?: (expandedKeys: Array<string>, info: { node: AntTreeNode, expanded: boolean }) => void | PromiseLike<any>;
|
||||
onExpand?: (
|
||||
expandedKeys: string[],
|
||||
info: { node: AntTreeNode; expanded: boolean; },
|
||||
) => void | PromiseLike<any>;
|
||||
/** 点击复选框触发 */
|
||||
onCheck?: (checkedKeys: Array<string>, e: AntTreeNodeEvent) => void;
|
||||
onCheck?: (checkedKeys: string[], e: AntTreeNodeEvent) => void;
|
||||
/** 点击树节点触发 */
|
||||
onSelect?: (selectedKeys: Array<string>, e: AntTreeNodeEvent) => void;
|
||||
onSelect?: (selectedKeys: string[], e: AntTreeNodeEvent) => void;
|
||||
/** filter some AntTreeNodes as you need. it should return true */
|
||||
filterAntTreeNode?: (node: AntTreeNode) => boolean;
|
||||
/** 异步加载数据 */
|
||||
@ -77,6 +100,7 @@ export interface TreeProps {
|
||||
/** drop 触发时调用 */
|
||||
onDrop?: (options: AntTreeNodeMouseEvent) => void;
|
||||
style?: React.CSSProperties;
|
||||
showIcon?: boolean;
|
||||
prefixCls?: string;
|
||||
filterTreeNode?: (node: AntTreeNode) => boolean;
|
||||
}
|
||||
|
@ -50,7 +50,7 @@ subtitle: 树形控件
|
||||
| --- | --- | --- | --- |
|
||||
| disableCheckbox | 禁掉 checkbox | boolean | false |
|
||||
| disabled | 禁掉响应 | boolean | false |
|
||||
| icon | 自定义图标。可接收组件,props 为当前节点 props | element/Function(props):ReactNode | - |
|
||||
| icon | 自定义图标。可接收组件,props 为当前节点 props | ReactNode/Function(props):ReactNode | - |
|
||||
| isLeaf | 设置为叶子节点(设置了`loadData`时有效) | boolean | false |
|
||||
| key | 被树的 (default)ExpandedKeys / (default)CheckedKeys / (default)SelectedKeys 属性所用。注意:整个树范围内的所有节点的 key 值不能重复! | string | 内部计算出的节点位置 |
|
||||
| selectable | 设置节点是否可被选中 | boolean | true |
|
||||
|
Loading…
Reference in New Issue
Block a user