Skip to content

Commit 48687c5

Browse files
committed
Remove warnings, improve README
1 parent fa2af7d commit 48687c5

File tree

2 files changed

+29
-23
lines changed

2 files changed

+29
-23
lines changed

README.md

Lines changed: 29 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# React Sortable Tree
22

3-
[![tree200](https://cloud.githubusercontent.com/assets/4413963/18860410/26f64de8-84b8-11e6-9284-350308eed30a.png)](https://fritz-c.github.io/react-sortable-tree/)
3+
[![NPM](https://nodei.co/npm/react-sortable-tree.png)](https://npmjs.org/package/react-sortable-tree)
44

5-
__Note: This is a work in progress; most of the features are not yet implemented.__
5+
[![tree200](https://cloud.githubusercontent.com/assets/4413963/18860410/26f64de8-84b8-11e6-9284-350308eed30a.png)](https://fritz-c.github.io/react-sortable-tree/)
66

7-
[DEMO](https://fritz-c.github.io/react-sortable-tree/)
7+
### [Demo](https://fritz-c.github.io/react-sortable-tree/)
88

99
### Features
1010

@@ -39,24 +39,33 @@ export default class Tree extends Component {
3939

4040
Property | Type | Default | Required | Description
4141
:-------------------------|:--------------:|:-------------------:|:--------:|:----------------------------------------
42-
treeData | object[] | | yes | Tree data in the following format: `[{title: 'main', subtitle: 'sub'}, { title: 'value2', expanded: true, children: [{ title: 'value3') }] }]`.<br>`title` is the primary label for the node<br>`subtitle` is a secondary label for the node `expanded` shows children of the node if true, or hides them if false. Defaults to false.<br>`children` is an array of child nodes belonging to the node.
43-
style | object | | {} | Style applied to the container wrapping the tree (style defaults to {height: '100%'})
44-
className | string | | | Class name for the container wrapping the tree
45-
innerStyle | object | | {} | Style applied to the inner, scrollable container (for padding, etc.)
46-
rowHeight | number or func | `62` | | Used by react-virtualized Either a fixed row height (number) or a function that returns the height of a row given its index: `({ index: number }): number`
47-
reactVirtualizedListProps | object | | | Custom properties to hand to the [react-virtualized list](https://github.com/bvaughn/react-virtualized/blob/master/docs/List.md#prop-types)
48-
scaffoldBlockPxWidth | number | `44` | | The width of the blocks containing the lines representing the structure of the tree.
49-
maxDepth | number | | | Maximum depth nodes can be inserted at. Defaults to infinite.
50-
searchMethod | func | | | The method used to search nodes. Defaults to a function that uses the `searchQuery` string to search for nodes with matching `title` or `subtitle` values. NOTE: Changing `searchMethod` will not update the search, but changing the `searchQuery` will.
51-
searchQuery | any | | null | Used by the `searchMethod` to highlight and scroll to matched nodes. Should be a string for the default `searchMethod`, but can be anything when using a custom search.
52-
searchFocusOffset | number | | | Outline the <`searchFocusOffset`>th node and scroll to it.
53-
searchFinishCallback | func | | | Get the nodes that match the search criteria. Used for counting total matches, etc.
54-
generateNodeProps | func | | | Generate an object with additional props to be passed to the node renderer. Use this for adding buttons via the `buttons` key, or additional `style` / `className` settings.
42+
treeData | object[] | | yes | Tree data with the following keys: <div>`title` is the primary label for the node.</div><div>`subtitle` is a secondary label for the node.</div><div>`expanded` shows children of the node if true, or hides them if false. Defaults to false.</div><div>`children` is an array of child nodes belonging to the node.</div><div>__Example__: `[{title: 'main', subtitle: 'sub'}, { title: 'value2', expanded: true, children: [{ title: 'value3') }] }]`
43+
onChange | func | | yes | Called whenever tree data changed. Just like with React input elements, you have to update your own component's data to see the changes reflected.<div>`( treeData: object[] ): void`</div>
44+
style | object | `{}` | | Style applied to the container wrapping the tree (style defaults to {height: '100%'})
45+
className | string | | | Class name for the container wrapping the tree
46+
innerStyle | object | `{}` | | Style applied to the inner, scrollable container (for padding, etc.)
47+
maxDepth | number | | | Maximum depth nodes can be inserted at. Defaults to infinite.
48+
searchMethod | func | | | The method used to search nodes. Defaults to a function that uses the `searchQuery` string to search for nodes with matching `title` or `subtitle` values. NOTE: Changing `searchMethod` will not update the search, but changing the `searchQuery` will.<div>`({ node: object, path: number[] or string[], treeIndex: number, searchQuery: any }): bool`</div>
49+
searchQuery | string or any | `null` | | Used by the `searchMethod` to highlight and scroll to matched nodes. Should be a string for the default `searchMethod`, but can be anything when using a custom search.
50+
searchFocusOffset | number | | | Outline the <`searchFocusOffset`>th node and scroll to it.
51+
searchFinishCallback | func | | | Get the nodes that match the search criteria. Used for counting total matches, etc.<div>`(matches: { node: object, path: number[] or string[], treeIndex: number }[]): void`</div>
52+
generateNodeProps | func | | | Generate an object with additional props to be passed to the node renderer. Use this for adding buttons via the `buttons` key, or additional `style` / `className` settings.<div>`({ node: object, path: number[] or string[], treeIndex: number, lowerSiblingCounts: number[], isSearchMatch: bool, isSearchFocus: bool }): object`</div>
53+
getNodeKey | func | defaultGetNodeKey | | Determine the unique key used to identify each node and generate the `path` array passed in callbacks. By default, returns the index in the tree (omitting hidden nodes).<div>`({ node: object, treeIndex: number }): string or number`</div>
54+
onMoveNode | func | | | Called after node move operation. <div>`({ treeData: object[], node: object }): void`</div>
55+
onVisibilityToggle | func | | | Called after children nodes collapsed or expanded. <div>`({ treeData: object[], node: object, expanded: bool }): void`</div>
56+
reactVirtualizedListProps | object | | | Custom properties to hand to the [react-virtualized list](https://github.com/bvaughn/react-virtualized/blob/master/docs/List.md#prop-types)
57+
rowHeight | number or func | `62` | | Used by react-virtualized. Either a fixed row height (number) or a function that returns the height of a row given its index: `({ index: number }): number`
58+
scaffoldBlockPxWidth | number | `44` | | The width of the blocks containing the lines representing the structure of the tree.
5559
nodeContentRenderer | any | NodeRendererDefault | | Override the default component for rendering nodes (but keep the scaffolding generator) This is an advanced option for complete customization of the appearance. It is best to copy the component in `node-renderer-default.js` to use as a base, and customize as needed.
56-
getNodeKey | func | defaultGetNodeKey | | Determine the unique key used to identify each node and generate the `path` array passed in callbacks. By default, returns the index in the tree (omitting hidden nodes).
57-
onChange | func | | yes | Called whenever tree data changed. Just like with React input elements, you have to update your own component's data to see the changes reflected.
58-
onMoveNode | func | | | Called after node move operation.
59-
onVisibilityToggle | func | | | Called after children nodes collapsed or expanded.
60+
61+
## Browser Compatibility
62+
63+
| Browser | Works? |
64+
|:-----|:-----|
65+
| Chrome | Yes |
66+
| Firefox | Yes, but [no auto-scroll on drag](https://github.com/fritz-c/react-sortable-tree/issues/3) |
67+
| Safari | Yes, but [no auto-scroll on drag](https://github.com/fritz-c/react-sortable-tree/issues/3) |
68+
| IE >= 9 | Yes, but [no auto-scroll on drag](https://github.com/fritz-c/react-sortable-tree/issues/3) |
6069

6170
## Contributing
6271

src/examples/basicExample/app.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -208,9 +208,6 @@ class App extends Component {
208208
</section>
209209

210210
<section className={styles['main-content']}>
211-
<span style={{ color: 'firebrick' }}>
212-
Note: This is a work in progress; most of the features are not yet implemented.
213-
</span>
214211
<h3>Demo</h3>
215212

216213
<div style={{ height: 450 }}>

0 commit comments

Comments
 (0)