-
-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
177 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
/*! infinite-tree v0.6.3 | (c) 2016 Cheton Wu <[email protected]> | MIT | https://github.com/cheton/infinite-tree */ | ||
/*! infinite-tree v0.7.0 | (c) 2016 Cheton Wu <[email protected]> | MIT | https://github.com/cheton/infinite-tree */ | ||
(function webpackUniversalModuleDefinition(root, factory) { | ||
if(typeof exports === 'object' && typeof module === 'object') | ||
module.exports = factory(); | ||
|
@@ -149,6 +149,7 @@ return /******/ (function(modules) { // webpackBootstrap | |
autoOpen: false, | ||
droppable: false, | ||
el: null, | ||
loadNodes: null, | ||
rowRenderer: _renderer.defaultRowRenderer, | ||
selectable: true, | ||
shouldSelectNode: null | ||
|
@@ -708,6 +709,42 @@ return /******/ (function(modules) { // webpackBootstrap | |
return false; | ||
} | ||
|
||
if (!node.hasChildren() && node.loadOnDemand) { | ||
if (typeof this.options.loadNodes !== 'function') { | ||
return false; | ||
} | ||
|
||
// Set loading state to true | ||
node.state.loading = true; | ||
this.rows[nodeIndex] = this.options.rowRenderer(node, this.options); | ||
|
||
// Updates list with new data | ||
this.update(); | ||
|
||
this.options.loadNodes(node, function (err, nodes) { | ||
// Set loading state to false | ||
node.state.loading = false; | ||
_this5.rows[nodeIndex] = _this5.options.rowRenderer(node, _this5.options); | ||
|
||
// Updates list with new data | ||
_this5.update(); | ||
|
||
if (err) { | ||
return; | ||
} | ||
|
||
// Append child nodes | ||
nodes.forEach(function (childNode) { | ||
_this5.appendChildNode(childNode, node); | ||
}); | ||
|
||
// Call openNode again | ||
_this5.openNode(node); | ||
}); | ||
|
||
return false; | ||
} | ||
|
||
node.state.open = true; // Set node.state.open to true | ||
var openNodes = [node].concat(this.state.openNodes); // the most recently used items first | ||
this.state.openNodes = openNodes; | ||
|
@@ -2201,6 +2238,8 @@ return /******/ (function(modules) { // webpackBootstrap | |
var defaultRowRenderer = function defaultRowRenderer(node, treeOptions) { | ||
var id = node.id; | ||
var label = node.label; | ||
var _node$loadOnDemand = node.loadOnDemand; | ||
var loadOnDemand = _node$loadOnDemand === undefined ? false : _node$loadOnDemand; | ||
var children = node.children; | ||
var state = node.state; | ||
var depth = state.depth; | ||
|
@@ -2220,6 +2259,9 @@ return /******/ (function(modules) { // webpackBootstrap | |
if (more && !open) { | ||
togglerContent = '►'; | ||
} | ||
if (!more && loadOnDemand) { | ||
togglerContent = '►'; | ||
} | ||
var toggler = (0, _helper.buildHTML)('a', togglerContent, { | ||
'class': function () { | ||
if (more && open) { | ||
|
@@ -2228,6 +2270,9 @@ return /******/ (function(modules) { // webpackBootstrap | |
if (more && !open) { | ||
return (0, _helper.classNames)('tree-toggler', 'tree-closed'); | ||
} | ||
if (!more && loadOnDemand) { | ||
return (0, _helper.classNames)('tree-toggler', 'tree-closed'); | ||
} | ||
return ''; | ||
}() | ||
}); | ||
|
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// | ||
// http://stackoverflow.com/questions/6410730/webkit-css-endless-rotation-animation-how | ||
// | ||
@-webkit-keyframes rotating /* Safari and Chrome */ { | ||
from { | ||
transform: rotate(0deg); | ||
} | ||
to { | ||
transform: rotate(360deg); | ||
} | ||
} | ||
@keyframes rotating { | ||
from { | ||
transform: rotate(0deg); | ||
} | ||
to { | ||
transform: rotate(360deg); | ||
} | ||
} | ||
.rotating { | ||
animation: rotating 2s linear infinite; | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters