• Stars
    star
    287
  • Rank 144,232 (Top 3 %)
  • Language
    TypeScript
  • License
    MIT License
  • Created almost 9 years ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

React Tree Select

rc-tree-select

React TreeSelect Component

NPM version dumi build status Test coverage Dependencies DevDependencies npm download bundle size

Screenshots

Development

npm install
npm start

Example

http://localhost:8000/examples/

online example: https://tree-select-react-component.vercel.app/

install

rc-tree-select

API

TreeSelect props

name description type default
className additional css class of root dom node String ''
prefixCls prefix class String ''
animation dropdown animation name. only support slide-up now String ''
transitionName dropdown css animation name String ''
choiceTransitionName css animation name for selected items at multiple mode String ''
dropdownMatchSelectWidth whether dropdown's with is same with select. Default set min-width same as input bool true
dropdownClassName additional className applied to dropdown String -
dropdownStyle additional style applied to dropdown Object {}
dropdownPopupAlign specify alignment for dropdown (alignConfig of dom-align) Object -
onDropdownVisibleChange control dropdown visible function () => { return true; }
notFoundContent specify content to show when no result matches. String 'Not Found'
showSearch whether show search input in single mode bool true
allowClear whether allowClear bool false
maxTagTextLength max tag text length to show number -
maxTagCount max tag count to show number -
maxTagPlaceholder placeholder for omitted values ReactNode/function(omittedValues) -
multiple whether multiple select (true when enable treeCheckable) bool false
disabled whether disabled select bool false
searchValue work with onSearch to make search value controlled. string ''
defaultValue initial selected treeNode(s) same as value type -
value current selected treeNode(s). normal: String/Array. labelInValue: {value:String,label:React.Node}/Array<{value,label}>. treeCheckStrictly(halfChecked default false): {value:String,label:React.Node, halfChecked}/Array<{value,label,halfChecked}>. -
labelInValue whether to embed label in value, see above value type Bool false
onChange called when select treeNode or input value change function(value, label(null), extra) -
onSelect called when select treeNode function(value, node, extra) -
onSearch called when input changed function -
onTreeExpand called when tree node expand function(expandedKeys) -
showCheckedStrategy TreeSelect.SHOW_ALL: show all checked treeNodes (Include parent treeNode). TreeSelect.SHOW_PARENT: show checked treeNodes (Just show parent treeNode). Default just show child. enum{TreeSelect.SHOW_ALL, TreeSelect.SHOW_PARENT, TreeSelect.SHOW_CHILD } TreeSelect.SHOW_CHILD
treeIcon show tree icon bool false
treeLine show tree line bool false
treeDefaultExpandAll default expand all treeNode bool false
treeDefaultExpandedKeys default expanded treeNode keys Array -
treeExpandedKeys set tree expanded keys Array -
treeExpandAction Tree open logic, optional: false | click | doubleClick, same as expandAction of rc-tree string | boolean click
treeCheckable whether tree show checkbox (select callback will not fire) bool false
treeCheckStrictly check node precisely, parent and children nodes are not associated bool false
filterTreeNode whether filter treeNodes by input value. default filter by treeNode's treeNodeFilterProp prop's value bool/Function(inputValue:string, treeNode:TreeNode) Function
treeNodeFilterProp which prop value of treeNode will be used for filter if filterTreeNode return true String 'value'
treeNodeLabelProp which prop value of treeNode will render as content of select String 'title'
treeData treeNodes data Array, if set it then you need not to construct children TreeNode. (value should be unique across the whole array) array<{value,label,children, [disabled,selectable]}> []
treeDataSimpleMode enable simple mode of treeData.(treeData should be like this: [{id:1, pId:0, value:'1', label:"test1",...},...], pId is parent node's id) bool/object{id:'id', pId:'pId', rootPId:null} false
loadData load data asynchronously function(node) -
getPopupContainer container which popup select menu rendered into function(trigger:Node):Node function(){return document.body;}
autoClearSearchValue auto clear search input value when multiple select is selected/deselected boolean true
suffixIcon specify the select arrow icon ReactNode | (props: TreeProps) => ReactNode -
clearIcon specify the clear icon ReactNode | (props: TreeProps) => ReactNode -
removeIcon specify the remove icon ReactNode | (props: TreeProps) => ReactNode -
switcherIcon specify the switcher icon ReactNode | (props: TreeProps) => ReactNode -
virtual Disable virtual when false false -

TreeNode props

note: you'd better to use treeData instead of using TreeNode.

name description type default
disabled disable treeNode bool false
key it's value must be unique across the tree's all TreeNode, you must set it String -
value default as treeNodeFilterProp (be unique across the tree's all TreeNode) String ''
title tree/subTree's title String/element '---'
isLeaf whether it's leaf node bool false

note

  1. Optimization tips(when there are large amounts of data, like more than 5000 nodes)
    • Do not Expand all nodes.
    • Recommend not exist many TreeSelect components in a page at the same time.
    • Recommend not use treeCheckable mode, or use treeCheckStrictly.
  2. In treeCheckable mode, It has the same effect when click x(node in Selection box) or uncheck in the treeNode(in dropdown panel), but the essence is not the same. So, even if both of them trigger onChange method, but the parameters (the third parameter) are different. (中文:在treeCheckable模式下,已选择节点上的x删除操作、和相应 treeNode 节点上 checkbox 的 uncheck 操作,最终效果相同,但本质不一样。前者跟弹出的 tree 组件可以“毫无关系”(例如 dropdown 没展开过,tree 也就没渲染好),而后者是 tree 组件上的节点 uncheck 事件。所以、即便两者都会触发onChange方法、但它们的参数(第三个参数)是不同的。)

Test Case

http://localhost:8000/tests/runner.html?coverage

Coverage

http://localhost:8000/node_modules/rc-server/node_modules/node-jscover/lib/front-end/jscoverage.html?w=http://localhost:8000/tests/runner.html?coverage

License

rc-tree-select is released under the MIT license.

More Repositories

1

slider

React Slider
JavaScript
2,962
star
2

form

React High Order Form Component(web & react-native)
JavaScript
1,799
star
3

calendar

React Calendar
JavaScript
1,681
star
4

table

React Table
TypeScript
1,183
star
5

tree

React Tree
TypeScript
1,113
star
6

field-form

⚡️ React Performance First Form Component
TypeScript
914
star
7

tooltip

React Tooltip
TypeScript
896
star
8

select

React Select
TypeScript
854
star
9

upload

React Upload
TypeScript
766
star
10

progress

React Progress Bar
TypeScript
678
star
11

animate

anim react element easily
JavaScript
675
star
12

menu

React Menu
TypeScript
655
star
13

virtual-list

🧾 React Virtual List Component which worked with animation
TypeScript
645
star
14

pagination

React Pagination
TypeScript
629
star
15

util

Common Utils For React Component
TypeScript
627
star
16

tabs

React Tabs
TypeScript
540
star
17

queue-anim

Animate React Component in queue
TypeScript
476
star
18

time-picker

React TimePicker
JavaScript
463
star
19

dialog

React Dialog
TypeScript
424
star
20

color-picker

React ColorPicker
TypeScript
422
star
21

m-date-picker

React Mobile DatePicker(web & react-native)
TypeScript
400
star
22

react-component.github.io

docs and site of react-component
HTML
378
star
23

drawer

React Drawer
TypeScript
372
star
24

tween-one

Animate One React Element
TypeScript
370
star
25

notification

React Notification
TypeScript
364
star
26

trigger

Abstract React Trigger
TypeScript
345
star
27

collapse

React Collapse / Accordion
TypeScript
319
star
28

steps

React Steps
TypeScript
311
star
29

scroll-anim

Animate Scroll React Component
JavaScript
301
star
30

input-number

React Input Number
TypeScript
296
star
31

picker

📅 All Date Pickers you need.
TypeScript
265
star
32

m-picker

React Mobile Picker(web & react-native)
TypeScript
247
star
33

swipeout

React Swipeout(web & react-native)
TypeScript
213
star
34

rc-tools

Tools For React Component
JavaScript
205
star
35

cascader

cascade select in one box
TypeScript
198
star
36

switch

React Switch
JavaScript
187
star
37

image

🖼 React Image Component
TypeScript
185
star
38

banner-anim

Animate Banner React Component
JavaScript
170
star
39

m-pull-to-refresh

React Mobile Pull To Refresh
TypeScript
164
star
40

dropdown

React Dropdown
TypeScript
163
star
41

texty

React Text Animate
TypeScript
154
star
42

resize-observer

👓 Resize observer for React
JavaScript
153
star
43

m-tabs

React Mobile Tabs Component (web & react-native)
TypeScript
139
star
44

checkbox

React Checkbox
TypeScript
130
star
45

motion

⛷ CSS Animation for React
TypeScript
120
star
46

gesture

Support gesture for react component.
TypeScript
103
star
47

rate

React Rate
JavaScript
91
star
48

footer

🐾 Pretty Footer react component used in ant.design
JavaScript
87
star
49

form-validation

This project is deprecated, you can try https://github.com/react-component/form
JavaScript
86
star
50

m-list-view

ReactNative ListView Web Port
JavaScript
85
star
51

align

Abstract React Align
TypeScript
81
star
52

mentions

React Mentions
TypeScript
67
star
53

rn-packager

Standalone ReactNative Packager
JavaScript
66
star
54

generator-rc

yeoman generator for react component
JavaScript
58
star
55

editor-core

a draft-js based editor
TypeScript
56
star
56

m-drawer

React Drawer
JavaScript
54
star
57

cropping

image cropping
TypeScript
54
star
58

editor-mention

React Mention
JavaScript
53
star
59

m-cascader

React Mobile Cascader Component(web and react-native)
TypeScript
51
star
60

m-dialog

React Mobile Dialog(web & react-native)
TypeScript
45
star
61

spider

React Tree Diagrams
JavaScript
44
star
62

overflow

📦 Auto collapse box util component
TypeScript
42
star
63

css-transition-group

standalone CSSTransitionGroup for React.addons.CSSTransitionGroup
JavaScript
38
star
64

m-calendar

React Mobile Calendar Component (web)
TypeScript
36
star
65

m-feedback

:active pseudo-class with react for mobile
TypeScript
36
star
66

input

React Input Component
TypeScript
35
star
67

tour

TypeScript
30
star
68

pager

React Pager
JavaScript
26
star
69

m-notification

JavaScript
23
star
70

dropzone

React Dropzone
JavaScript
23
star
71

textarea

React Textarea
TypeScript
22
star
72

radio

[DEPRECATED] React Radio
CSS
19
star
73

m-input-number

input-number mobile ui component for react (web & react-native)
TypeScript
17
star
74

portal

TypeScript
16
star
75

touchable

React Touchable Component
TypeScript
16
star
76

rc-server

This project is deprecated, use rc-tools run server
JavaScript
15
star
77

gulp-jsx2example

Compile JSX file to HTML (react demo)
JavaScript
13
star
78

cascade-select

React CascadeSelect
JavaScript
13
star
79

icon-anim

Icon cutover or morph animate React Element
JavaScript
12
star
80

m-select-list

React Mobile Select List Component
JavaScript
12
star
81

segmented

React Segmented Controls
TypeScript
12
star
82

rc-test

test react component
JavaScript
11
star
83

mobile

ant design mobile components
TypeScript
10
star
84

m-tooltip

React Tooltip for mobile
TypeScript
8
star
85

context

TypeScript
7
star
86

rn-tools

tools for react-native
JavaScript
7
star
87

rn-core

Standalone ReactNative Framework
Objective-C
6
star
88

m-trigger

React Trigger Component for mobile
JavaScript
6
star
89

record

Record audio from microphone
JavaScript
5
star
90

.github

5
star
91

RNPlayground

react-native playground container
Objective-C
5
star
92

mutate-observer

TypeScript
5
star
93

editor-plugin-emoji

HTML
4
star
94

m-steps

React Steps for mobile
CSS
4
star
95

editor-plugin-basic-style

TypeScript
3
star
96

mini-decimal

TypeScript
3
star
97

editor-utils

editor utilities
TypeScript
2
star
98

father-plugin

father plugin for all react-component project
TypeScript
1
star
99

qrcode

TypeScript
1
star
100

editor-plugin-image

TypeScript
1
star