Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,7 @@

Tree component.

[![NPM version][npm-image]][npm-url]
[![npm download][download-image]][download-url]
[![build status][github-actions-image]][github-actions-url]
[![Codecov][codecov-image]][codecov-url]
[![bundle size][bundlephobia-image]][bundlephobia-url]
[![dumi][dumi-image]][dumi-url]
[![NPM version][npm-image]][npm-url] [![npm download][download-image]][download-url] [![build status][github-actions-image]][github-actions-url] [![Codecov][codecov-image]][codecov-url] [![bundle size][bundlephobia-image]][bundlephobia-url] [![dumi][dumi-image]][dumi-url]

[npm-image]: http://img.shields.io/npm/v/rc-tree.svg?style=flat-square
[npm-url]: http://npmjs.org/package/rc-tree
Expand Down Expand Up @@ -45,6 +40,7 @@ online example: https://tree.react-component.now.sh/
[![rc-tree](https://nodei.co/npm/rc-tree.png)](https://npmjs.org/package/rc-tree)

## Usage

> Note: `import "rc-tree/assets/index.css"`

see examples
Expand Down Expand Up @@ -95,7 +91,7 @@ see examples
| switcherIcon | specific the switcher icon. | ReactNode / (props: TreeNodeAttribute) => ReactNode | - |
| virtual | Disable virtual scroll when `false` | boolean | - |
| allowDrop | Whether to allow drop on node | ({ dragNode, dropNode, dropPosition }) => boolean | - |
| dropIndicatorRender | The indicator to render when dragging | ({ dropPosition, dropLevelOffset, indent: number, prefixCls }) => ReactNode| - |
| dropIndicatorRender | The indicator to render when dragging | ({ dropPosition, dropLevelOffset, indent: number, prefixCls }) => ReactNode | - |
| direction | Display direction of the tree, it may affect dragging behavior | `ltr` \| `rtl` | - |
| expandAction | Tree open logic, optional: false \| `click` \| `doubleClick` | string \| boolean | `click` |

Expand Down
11 changes: 7 additions & 4 deletions src/interface.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,12 @@ export type KeyEntities<DateType extends BasicDataNode = any> = Record<
DataEntity<DateType>
>;

export type DataNode = FieldDataNode<{
key: Key;
title?: React.ReactNode | ((data: DataNode) => React.ReactNode);
}>;
export type DataNode<T = Record<string, unknown>> = FieldDataNode<
{
key: Key;
title?: React.ReactNode | ((data: DataNode<T>) => React.ReactNode);
} & T
>;

export type EventDataNode<TreeDataType> = {
key: Key;
Expand Down Expand Up @@ -151,4 +153,5 @@ export interface FieldNames {
_title?: string[];
key?: string;
children?: string;
[key: string]: string | string[] | undefined;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个也是不知道是什么类型的,万一是 Date 是 number 呢?

}
Loading