Skip to content
This repository was archived by the owner on Jul 15, 2019. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
d7782b4
Use context in order to pass custom click listener.
vivian-perez Apr 16, 2015
95c53c8
TEST TreeView / TreeNode /TreeViewwith contexts
vivian-perez Apr 16, 2015
65fcfdd
Message of precedent commit:
vivian-perez Apr 16, 2015
360c76f
Add a treeNodeAttributes propType in TreeView.
vivian-perez Apr 16, 2015
25d1968
Merge pull request #1 from Elipce-Informatique/ClickByProps
vivian-perez Apr 16, 2015
ee3ce15
react-bootstrap-treeview is now a commonJS component.
vivian-perez Apr 17, 2015
589f6f5
modify readme
vivian-perez Apr 17, 2015
d51cb43
update readme
vivian-perez Apr 17, 2015
c9e084b
update readme
vivian-perez Apr 17, 2015
bc15010
update readme
vivian-perez Apr 17, 2015
60a664a
Update package.json
YannPl Apr 17, 2015
e1c4d1a
Delete bower.json
YannPl Apr 17, 2015
10a9649
publish DIST
vivian-perez Apr 17, 2015
41aa9b8
Merge remote-tracking branch 'origin/master'
vivian-perez Apr 17, 2015
bf1e9f9
TreeView ADD prop boolean iSelectionExclusive (default false): When a…
vivian-perez Apr 20, 2015
bf4e20e
UPDATE readme
vivian-perez Apr 20, 2015
b56c378
Update package.json
vivian-perez Apr 20, 2015
6814ee1
Update react-bootstrap-treeview.jsx
YannPl Apr 28, 2015
6dbe0b7
Update package.json
YannPl Apr 28, 2015
ca1c18d
GRUNT des modifs effectuées dans le précédent commit
vivian-perez Apr 28, 2015
072a7d0
TreeNaode : suppression du keu au niveau du LI
vivian-perez Apr 28, 2015
4494bde
Treenode:
vivian-perez Jun 3, 2015
70a7678
Version 0.2.3
vivian-perez Jun 3, 2015
0bb6fe0
Badge
vivian-perez Jun 11, 2015
2520329
Improvments
vivian-perez Jun 12, 2015
c9e772d
Suppression log console
vivian-perez Jun 12, 2015
6433540
Suppression log console
vivian-perez Jun 12, 2015
c61bf68
0.2.6
vivian-perez Jun 12, 2015
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
node_modules/
public/bower_components/
public/index.html
84 changes: 50 additions & 34 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -1,36 +1,52 @@
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'), // the package file to use

react: {
single_file_output: {
files: {
'public/js/react-bootstrap-treeview.js': 'src/react-bootstrap-treeview.jsx'
module.exports = function (grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'), // the package file to use

react: {
single_file_output: {
files: {
'dist/js/react-bootstrap-treeview.js': 'src/react-bootstrap-treeview.jsx'
}
}
},

watch: {
files: ['<%= react.single_file_output.files[\'dist/js/react-bootstrap-treeview.js\'] %>', '<%= browserify.main.src %>'],
tasks: ['default', 'browserify']
},

copy: {
main: {
files: [
// copy src to example
{expand: true, cwd: 'src/', src: '*.css', dest: 'dist/css/'},
{expand: true, cwd: 'src/', src: '*.css', dest: 'example/public/css/'}
// { expand: true, cwd: 'src/js', src: '*', dest: 'public/js/' }
]
}
},

'browserify': {
main: {
options: {
debug: true,
transform: ['reactify'],
extensions: ['.jsx']
},
src: 'example/js/example.js',
dest: 'example/public/js/example.js'

}

}
}
},

watch: {
files: [/*'tests/*.js', 'tests/*.html', */'src/**'],
tasks: ['default']
},

copy: {
main: {
files: [
// copy src to example
{ expand: true, cwd: 'src/', src: '*.css', dest: 'public/css/' },
// { expand: true, cwd: 'src/js', src: '*', dest: 'public/js/' }
]
}
}
});

// load up your plugins
grunt.loadNpmTasks('grunt-react');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-copy');

// register one or more task lists (you should ALWAYS have a "default" task list)
grunt.registerTask('default', ['react', 'copy', 'watch']);
});

// load up your plugins
grunt.loadNpmTasks('grunt-react');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-browserify');

// register one or more task lists (you should ALWAYS have a "default" task list)
grunt.registerTask('default', ['react', 'copy', 'browserify', 'watch']);
};
67 changes: 34 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,10 @@ Include the correct styles, it's mainly just bootstrap but we add a few tweaks a
<link href="path/to/react-bootstrap-treeview.css" rel="stylesheet">
```

Add required libraries.
Require the commonJS TreeView

```html
<!-- Required JavaScript -->
<script src="path/to/react.js"></script>
<script src="path/to/react-bootstrap-tree.js"></script>
```js
var TreeView = require('react-bootstrap-treeview');
```

Then, a basic initialization would look like.
Expand All @@ -55,37 +53,15 @@ React.render(
);
```

Ifyou don't use browserify, include js files in dist folder
<script src="path/to/react-bootstrap-treeview.js"></script>

### Example

Putting it all together a minimal implementation might look like this.
An example can be run via the command:
grunt

```html
<html>
<head>
<title>React + Bootstrap Tree View</title>
<link href="path/to/bootstrap.css" rel="stylesheet">
<link href="path/to/react-bootstrap-treeview.css" rel="stylesheet">
</head>
<body>
<div class="container">
<h1>React + Bootstrap Tree View</h1>
<br/>
<div class="row">
<div id="treeview"></div>
</div>
</div>
<script src="path/to/react.js"></script>
<script src="path/to/JSXTransformer.js"></script>
<script src="path/to/react-bootstrap-treeview.js"></script>
<script type="text/jsx">
React.render(
<TreeView data={data} />,
document.getElementById('treeview')
);
</script>
</body>
</html>
```
Files are created in example/public folder.


## Data Structure
Expand Down Expand Up @@ -276,6 +252,12 @@ Boolean. Default: true

Whether or not to highlight the selected node.

#### isSelectionExclusive
Boolean, Default false

If true, when a line is selected, others are unselected


#### levels
Integer. Default: 2

Expand All @@ -286,6 +268,9 @@ String, class name(s). Default: "glyphicon glyphicon-stop" as defined by [Boots

Sets the default icon to be used on all nodes, except when overridden on a per node basis in data.

#### onLineClicked
Function, callback call when a line (node) is clicked

#### selectedBackColor
String, [any legal color value](http://www.w3schools.com/cssref/css_colors_legal.asp). Default: '#428bca'.

Expand All @@ -306,7 +291,23 @@ Boolean. Default: false

Whether or not to display tags to the right of each node. The values of which must be provided in the data structure on a per node basis.

#### treeNodeAttributes
Object, couples of keys/values ```{key1 : value1, key2 : value2}```

*key:* HTML attribute of the node ```<li>```

*value:* Dynamic data computed from this.props.data

example:
```javascript
treeNodeAttributes = {'data-foo' : 'bar'}
data = {
text: 'Parent 1',
bar: '1'
}
```
The node "Parent 1" will have a data-id attribute equals to 1
```html <li data-foo="1" /> Parent 1 </li>```

## Copyright and Licensing
Copyright 2013 Jonathan Miles
Expand Down
32 changes: 0 additions & 32 deletions bower.json

This file was deleted.

20 changes: 20 additions & 0 deletions dist/css/react-bootstrap-treeview.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@

.treeview .list-group-item {
cursor: pointer;
}

.treeview span:not(.badge) {
width: 1rem;
height: 1rem;
}

.treeview span.indent {
margin-left: 6px;
margin-right: 6px;
}

.treeview span.icon {
margin-left: 0px;
margin-right: 6px;
}

29 changes: 29 additions & 0 deletions dist/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<html>
<head>
<title>React.js Tree View <i>for Twitter Bootstrap</title>
<script src="http://code.jquery.com/jquery-2.1.3.min.js"></script>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">

<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap-theme.min.css">

<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
<link href="./css/react-bootstrap-treeview.css" rel="stylesheet">
</head>
<body>
<div class="container">
<h1>React.js Tree View <i>for Twitter Bootstrap</i></h1>
<br/>
<div class="row">
<div id="treeview"></div>
</div>
</div>
<script src="http://fb.me/react-with-addons-0.13.1.js"></script>
<script src="http://fb.me/JSXTransformer-0.13.1.js"></script>
<script src="./js/react-bootstrap-treeview.js"></script>
<script type="text/jsx" src="./js/example.jsx"></script>

</body>
</html>
Loading