Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 44218d5

Browse files
Merge pull request #1 from nil-components/develop
Develop
2 parents a92f28a + 9ebf9dd commit 44218d5

39 files changed

+1556
-39980
lines changed

‎.gitignore‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
/node_modules
22
/package-lock.json
3+
/examples/dist

‎README.md‎

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
# nil-tree
2+
3+
`npm install --save nil-tree`
4+
5+
6+
## Tree属性
7+
8+
```
9+
{
10+
prefixCls: 'nil-tree',
11+
className: '',
12+
rootId: null,
13+
loadingLabel: 'Loading...',
14+
loadingComponent: 'div',
15+
loadData: null,
16+
showIcon: true,
17+
showExpanderIcon: true,
18+
checkable: false,
19+
maxDepth: 50, //最大层级
20+
21+
rootComponent: 'div',
22+
childNodesWrapperComponent: ChildNodesWrapper,
23+
nodeItemWrapperComponent: Fragment,
24+
//自定义
25+
renderIndentIcons: null,
26+
renderExpanderIcon: null,
27+
renderLoadingIcon: null,
28+
renderIcon: null,
29+
renderCheckbox: null,
30+
renderLabel: null,
31+
renderExtIcons: null,
32+
renderNode: null,
33+
//events
34+
onNodeClick: noop,
35+
onNodeDoubleClick: noop,
36+
onNodeContextMenu: noop,
37+
onNodeMouseDown: noop,
38+
onNodeMouseUp: noop,
39+
onNodeMouseEnter: noop,
40+
onNodeMouseLeave: noop,
41+
onNodeMouseOver: noop,
42+
onNodeMouseOut: noop,
43+
onNodeMouseMove: noop,
44+
}
45+
```
46+
47+
## Node属性
48+
49+
- id
50+
- label
51+
- leaf
52+
- pid
53+
- cls
54+
- iconCls
55+
- relativeDepth [readonly]
56+
- expanded
57+
- checked
58+
- loading [readonly]
59+
- isRoot [readonly]
60+
61+
## 示例
62+
63+
```
64+
import React, { Component } from 'react';
65+
import TreeStore from 'xtree-store';
66+
import NilTree from 'nil-tree';
67+
import data from '../data.json';
68+
69+
export default class DEMO extends Component {
70+
71+
constructor(props) {
72+
super(props);
73+
74+
this.store = new TreeStore(data, {
75+
simpleData: true
76+
});
77+
78+
}
79+
80+
loadData = node => {
81+
const store = this.store;
82+
return store.getChildren(node.id);
83+
}
84+
85+
toggleExpand = (node, e, t) => {
86+
node.expanded = !node.expanded;
87+
node.checked = !node.checked;
88+
this.forceUpdate();
89+
//or
90+
// t.toggleExpand()
91+
}
92+
//checkable的选择状态需要通过回调设置checked
93+
render() {
94+
return (
95+
<NilTree
96+
onNodeClick={this.toggleExpand}
97+
loadData={this.loadData}
98+
showIcon
99+
checkable
100+
/>
101+
);
102+
}
103+
104+
}
105+
106+
```

‎examples/dist/index.html‎

Lines changed: 0 additions & 25 deletions
This file was deleted.

‎examples/dist/static/css/app.8b44d728.css‎

Lines changed: 0 additions & 66 deletions
This file was deleted.

‎examples/dist/static/css/app.8b44d728.css.map‎

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /