diff --git a/components/tree/demo/basic.md b/components/tree/demo/basic.md index c3d86c0c2b..256535da1b 100644 --- a/components/tree/demo/basic.md +++ b/components/tree/demo/basic.md @@ -11,7 +11,7 @@ var Tree = antd.Tree; var TreeNode = Tree.TreeNode; React.render( - + diff --git a/components/tree/demo/checkbox.md b/components/tree/demo/checkbox.md index 19b2b07943..81593c7548 100644 --- a/components/tree/demo/checkbox.md +++ b/components/tree/demo/checkbox.md @@ -9,62 +9,13 @@ ````jsx var Tree = antd.Tree; var TreeNode = Tree.TreeNode; -var velocity = antd.velocity; function handleCheck(info) { console.log('check: ', info); } -const animation = { - enter(node, done){ - var ok = false; - - function complete() { - if (!ok) { - ok = 1; - done(); - } - } - node.style.display='none'; - velocity(node, 'slideDown', { - duration: 300, - complete: complete - }); - return { - stop: function () { - velocity(node, 'finish'); - // velocity complete is async - complete(); - } - }; - }, - - leave(node, done){ - var ok = false; - - function complete() { - if (!ok) { - ok = 1; - done(); - } - } - - velocity(node, 'slideUp', { - duration: 300, - complete: complete - }); - return { - stop: function () { - velocity(node, 'finish'); - // velocity complete is async - complete(); - } - }; - }, -}; - React.render(
- {React.cloneElement( + @@ -75,10 +26,7 @@ React.render(
- , { - openAnimation: animation, - })} +
- , document.getElementById('components-tree-demo-checkbox')); ```` diff --git a/components/tree/index.jsx b/components/tree/index.jsx index c7d069df27..2647c62412 100644 --- a/components/tree/index.jsx +++ b/components/tree/index.jsx @@ -1,5 +1,57 @@ import React from 'react'; import Tree from 'rc-tree'; +import velocity from 'velocity-animate'; + +const animation = { + enter(node, done){ + var ok = false; + + function complete() { + if (!ok) { + ok = 1; + done(); + } + } + + node.style.display = 'none'; + velocity(node, 'slideDown', { + duration: 300, + complete: complete + }); + return { + stop: function () { + velocity(node, 'finish'); + // velocity complete is async + complete(); + } + }; + }, + + leave(node, done){ + var ok = false; + + node.style.display = 'block'; + + function complete() { + if (!ok) { + ok = 1; + done(); + } + } + + velocity(node, 'slideUp', { + duration: 300, + complete: complete + }); + return { + stop: function () { + velocity(node, 'finish'); + // velocity complete is async + complete(); + } + }; + }, +}; const AntTree = React.createClass({ getDefaultProps() { @@ -15,7 +67,7 @@ const AntTree = React.createClass({ if (checkable) { checkable = ; } - return + return {this.props.children} ; } diff --git a/index.js b/index.js index 1d93cb6463..0862816482 100644 --- a/index.js +++ b/index.js @@ -44,8 +44,6 @@ const antd = { Menu: require('./components/menu') }; -antd.velocity = require('velocity-animate'); - module.exports = antd; antd.version = require('./package.json').version;