npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@beisen-phoenix/base-tree

v3.3.55

Published

---

Downloads

406

Readme

rc-tree


API

Tree props

| name | description | type | default | |----------|----------------|----------|--------------| | autoExpandParent | 自动展开指定的父节点 | bool | false | | checkable | 节点前添加 Checkbox 复选框 | bool/React Node | false | | checkedKeys | 受控选中的树节点(设置后,默认选中的键将不起作用)。注意:父节点和子节点是关联的,如果父节点的键存在,则检查所有子节点,反之亦然。当设置checkable和checkStrictly时,它应该是一个包含checked数组和半checked数组的对象。 | String[]/{checked:Array,halfChecked:Array} | [] | | checkStrictly| checkable状态下节点选择完全受控(父子节点选中状态不再关联) | bool | false | | checkUpStrictly| checkable状态下节点选择父控子(父节点改变,子节点联动,子节点改变父节点选中状态不再关联) | bool | false | | className | 根dom节点的附加css类 | String | '' | | defaultCheckedKeys | 默认选中复选框的树节点 | String[] | [] | | defaultExpandedKeys | 默认展开指定的树节点 | String[] | - | | defaultExpandAll | 默认展开所有树节点 | bool | false | | defaultExpandParent | 默认展开父节点 | bool | true | | defaultSelectedKeys | 默认选中的树节点 | String[] | [] | | disabled | 是否禁用树 | bool | false | | draggable | 设置节点可拖拽(IE>8) | bool | false | | expandedKeys |(受控)展开指定的树节点 | String[] | - | | icon | 自定义图标。可接收组件,props 为当前节点 props | element/Function(props) | - | | loadedKeys | 受控)已经加载的节点,需要配合 loadData 使用 | string[] | - | | loadData | 异步加载数据,返回值应该是一个promise | function(node) | - | | multiple | 支持点选多个节点(节点本身) | bool | false | | prefixCls | 样式前缀 | String | 'rc-loadDatatree' | | selectable | 是否可以被选中 | bool | true | | selectedKeys | 受控选定树节点(设置后,默认选定的键将不起作用) | String[] | [] | | showIcon | 是否显示图标 | bool | true | | singleLine | 设置是否整行选中 | bool | false | | treeData | TreeNodes数据数组,如果设置了它,则不需要构造子TreeNode。(值在整个数组中应该是唯一的),***h目前仅对treeData方式的使用,做了整行选择样式支持扩展,其他使用保持原组件方式*** | array<{key,title,children, [disabled, selectable]}> | - | | onCheck | 单击TreeNode/复选框触发 | function(checkedKeys, e:{checked: bool, checkedNodes, node, event, nativeEvent}) | - | | onExpand | 展开/收起节点时触发 | function(expandedKeys, {expanded: bool, node, nativeEvent}) | - | | onDragEnd | dragend 触发时调用| function({event,node}) | - | | onDragEnter | dragenter 触发时调用 | function({event,node,expandedKeys}) | - | | onDragLeave | dragleave 触发时调用 | function({event,node}) | - | | onDragOver | dragover 触发时调用(一直) | function({event,node}) | - | | onDragStart | dragstart 触发时调用 | function({event,node}) | - | | onDrop | drop 触发时调用 | function({event, node, dragNode, dragNodesKeys}) | - | | onLoad | 节点加载完毕时触发 | - | | onMouseEnter | 当鼠标进入TreeNode时调用 | function({event,node}) | - | | onMouseLeave | 当鼠标离开TreeNode时调用 | function({event,node}) | - | | onRightClick | 响应右键点击 | function({event,node}) | - | | onSelect | 节点选中时触发 | function(selectedKeys, e:{selected: bool, selectedNodes, node, event, nativeEvent}) | - | | switcherIcon | 指定节点切换图标 | ReactNode / (props: TreeNodeAttribute) => ReactNode | - |

TreeNode props

note: if you have a lot of TreeNode, like more than 1000, make the parent node is collapsed by default, will obvious effect, very fast. Because the children hide TreeNode will not insert into dom.

| name | description | type | default | |----------|----------------|----------|--------------| |className | 节点附加的样式 | String | '' | |style | 设置节点的style样式 | Object | '' | |disabled | 是否禁用Treenode | bool | false | |disableCheckbox | 是否禁用Treenode'复选框 | bool | false | |title | 树/子树的标题 | String/element | '---' | |key | 节点标识,全局唯一。它与树属性(默认)expandedkeys/(默认)checkedkeys/(默认)selectedkeys一起使用。 | String | treeNode's position | |isLeaf | 是否为叶节点(设置了loadData时有效) | bool | false | |icon | 自定义图标。可接收组件,props 为当前节点 props | element/Function(props) | - | | switcherIcon | 指定节点切换图标 | ReactNode / (props: TreeNodeAttribute) => ReactNode | - |

note

The number of treeNodes can be very large, but when enable checkable, it will spend more computing time, so we cached some calculations(e.g. this.treeNodesStates), to avoid double computing. But, this bring some restrictions, when you async load treeNodes, you should render tree like this {this.state.treeData.length ? <Tree ...>{this.state.treeData.map(t => <TreeNode ... />)}</Tree> : 'loading tree'}

Development

npm install
npm start

Test Case

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

Coverage

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

License

rc-tree is released under the MIT license.

other tree view