diff --git a/demo/index.html b/demo/index.html
index a6eae5a..7209ad5 100755
--- a/demo/index.html
+++ b/demo/index.html
@@ -175,82 +175,77 @@
Lazy loading demo
+
-
-
+ if (enabled) {
+ node.customStyle['--paper-tree-toggle-theme'] = 'animation: blinker 1s linear infinite; content: \'⧖\'; margin-left: -21px;';
+ } else {
+ node.customStyle['--paper-tree-toggle-theme'] = ';';
+ }
+
+ node.updateStyles();
+ },
+
+ template.fetchChildren = function(node) {
+
+ // Set loading styles
+ this.setLoadingState(node, true);
+
+ window.setTimeout(function() {
+
+ // Add children to the node
+ node.set('data.children', [
+ {name: 'Zeus'},
+ {name: 'Apollo'},
+ {name: 'Athena'},
+ {name: 'Poseidon'}
+ ]);
+
+ // Reset loading styles
+ this.setLoadingState(node, false);
+
+ }.bind(this), Math.floor(Math.random() * 2000));
+ }
+
+
diff --git a/demo/lazyloading.html b/demo/lazyloading.html
index 5830ab0..32fdbef 100644
--- a/demo/lazyloading.html
+++ b/demo/lazyloading.html
@@ -9,15 +9,15 @@
@@ -36,7 +36,7 @@ Lazy loading paper-tree demo
window.setTimeout(function() {
tree.data = { name:'Cronos' };
// Fetching root children ...
- template.fetchNodeChildren(tree.$.root);
+ template.fetchChildren(tree.$.root);
}, 1000);
@@ -46,30 +46,22 @@ Lazy loading paper-tree demo
!target.loaded && target.getChildren().forEach(function(child){
target.loaded = true;
// Fetching children ...
- this.fetchNodeChildren(child);
+ this.fetchChildren(child);
}, this);
},
template.setLoadingState = function(node, enabled) {
if (enabled) {
- node.customStyle['--paper-tree-preicon-theme'] = '\
- content: \'\';\
- background:url(\'loading.svg\');\
- background-size:cover;\
- position:absolute;\
- width:24px;\
- height:24px;\
- margin-left:-24px;\
- ';
+ node.customStyle['--paper-tree-toggle-theme'] = 'animation: blinker 1s linear infinite; content: \'⧖\'; margin-left: -21px;';
} else {
- node.customStyle['--paper-tree-preicon-theme'] = ';';
+ node.customStyle['--paper-tree-toggle-theme'] = ';';
}
node.updateStyles();
},
- template.fetchNodeChildren = function(node) {
+ template.fetchChildren = function(node) {
// Set loading styles
this.setLoadingState(node, true);
diff --git a/demo/loading.svg b/demo/loading.svg
deleted file mode 100644
index 460e05d..0000000
--- a/demo/loading.svg
+++ /dev/null
@@ -1 +0,0 @@
-
\ No newline at end of file
diff --git a/demo/playground.html b/demo/playground.html
index 085d0a6..0a00b16 100644
--- a/demo/playground.html
+++ b/demo/playground.html
@@ -41,17 +41,7 @@ Media Tree
"icon": "weekend",
"open": true,
"children": [{
- "name": "Movies",
- "children": [{
- "name": "Interstellar",
- "icon": "theaters"
- }, {
- "name": "The Godfather",
- "icon": "theaters"
- }, {
- "name": "Pulp Fiction",
- "icon": "theaters"
- }]
+ "name": "Movies"
}, {
"name": "TV Shows",
"children": [{
diff --git a/paper-tree-node.html b/paper-tree-node.html
index 20c1df6..1c20434 100755
--- a/paper-tree-node.html
+++ b/paper-tree-node.html
@@ -23,7 +23,7 @@
----------------|-------------|----------
`--paper-tree-selected-background-color` | Highlight color for selected node | `rgba(200, 200, 200, 0.5)`
`--paper-tree-selected-color` | Text and icon color for selected node | `inherit`
-`--paper-tree-preicon-theme` | Change theme for node pre-icon (+/- toggle) |
+`--paper-tree-toggle-theme` | Change theme for node +/- toggle |
`--paper-tree-icon-theme` | Change theme for node icon |
@demo
@@ -44,8 +44,8 @@
display: inline-block;
}
- .node-preicon:before {
- @apply(--paper-tree-preicon-theme);
+ .node-container {
+ white-space: nowrap;
}
.node-row {
@@ -53,27 +53,26 @@
padding-right: 4px;
}
- .node-container{
- white-space: nowrap;
+ .node-preicon.collapsed,
+ .node-preicon.expanded {
+ padding-left: 0px;
}
.node-preicon {
- padding-left: 23px;
+ padding-left: 18px;
}
- .node-preicon.collapsed,
- .node-preicon.expanded {
- padding-left: 0px;
+ .node-preicon:before {
+ margin-right: 5px;
+ @apply(--paper-tree-toggle-theme);
}
.node-preicon.collapsed:before {
content: '\002B';
- padding: 5px;
}
.node-preicon.expanded:before {
content: '\2212';
- padding: 5px;
}
.node-preicon, .node-name {
@@ -112,7 +111,7 @@
-
+
{{data.name}}
@@ -209,8 +208,8 @@
* @param {string=folder} an icon name.
* @return {string} the computed icon name.
*/
- _computeIcon: function(data) {
- return data && data.icon ? data.icon : 'folder';
+ _computeIcon: function(icon) {
+ return icon ? icon : 'folder';
},
_actionClicked: function (event) {