diff --git a/components/common/openAnimation.js b/components/common/openAnimation.js new file mode 100644 index 0000000000..c0e55e751c --- /dev/null +++ b/components/common/openAnimation.js @@ -0,0 +1,40 @@ +import velocity from 'velocity-animate'; + +function animate(node, show, transitionName, done) { + let ok; + + function complete() { + if (!ok) { + ok = true; + done(); + } + } + + // Fix safari flash bug + node.style.display = show ? 'block' : 'none'; + velocity(node, transitionName, { + duration: 240, + complete: complete, + easing: 'easeInOutQuad' + }); + return { + stop() { + velocity(node, 'finish'); + complete(); + } + }; +} + +const animation = { + enter(node, done) { + animate(node, false, 'slideDown', done); + }, + leave(node, done) { + animate(node, true, 'slideUp', done); + }, + appear(node, done) { + animate(node, false, 'slideDown', done); + }, +}; + +export default animation; diff --git a/components/menu/index.jsx b/components/menu/index.jsx index fd88c99dba..2b98efb82c 100644 --- a/components/menu/index.jsx +++ b/components/menu/index.jsx @@ -1,38 +1,7 @@ import React from 'react'; import Menu from 'rc-menu'; import velocity from 'velocity-animate'; - -const animation = { - enter(node, done) { - this.animate(node, 'slideDown', done); - }, - leave(node, done) { - this.animate(node, 'slideUp', done); - }, - appear() { - return this.enter.apply(this, arguments); - }, - animate(node, transitionName, done) { - let ok; - function complete() { - if (!ok) { - ok = true; - done(); - } - } - velocity(node, transitionName, { - duration: 240, - complete: complete, - easing: 'easeInOutQuad' - }); - return { - stop() { - velocity(node, 'finish'); - complete(); - } - }; - } -}; +import animation from '../common/openAnimation'; const AntMenu = React.createClass({ getDefaultProps() { diff --git a/components/table/index.jsx b/components/table/index.jsx index 561c6cb28b..e3f083947e 100644 --- a/components/table/index.jsx +++ b/components/table/index.jsx @@ -5,7 +5,6 @@ import Checkbox from '../checkbox'; import FilterDropdown from './filterDropdown'; import Pagination from '../pagination'; import objectAssign from 'object-assign'; -import equals from 'is-equal-shallow'; function noop() { } @@ -31,12 +30,8 @@ class DataSource { } } - clone(config) { - if (config) { - return new DataSource(objectAssign(config, this.config)); - } else { - return this; - } + clone(config = {}) { + return new DataSource(objectAssign(config, this.config)); } } @@ -79,7 +74,8 @@ var AntTable = React.createClass({ }); } if (!this.isLocalDataSource()) { - if (!equals(nextProps, this.props)) { + // 外界只有 dataSource 的变化会触发请请求 + if (nextProps.dataSource !== this.props.dataSource) { this.setState({ selectedRowKeys: [], loading: true diff --git a/components/tree/index.jsx b/components/tree/index.jsx index 1d49fd9811..48b96c6608 100644 --- a/components/tree/index.jsx +++ b/components/tree/index.jsx @@ -1,61 +1,7 @@ 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(); - } - }; - }, - - appear(){ - return this.enter.apply(this, arguments); - }, - - 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(); - } - }; - }, -}; +import animation from '../common/openAnimation'; const AntTree = React.createClass({ getDefaultProps() { diff --git a/components/upload/getFileItem.js b/components/upload/getFileItem.js index b21eb9cf9e..12f2125f72 100644 --- a/components/upload/getFileItem.js +++ b/components/upload/getFileItem.js @@ -8,4 +8,4 @@ export default function getFileItem(file, fileList) { } })[0]; return target; -}; +} diff --git a/package.json b/package.json index f8c0504b8e..b731a46eba 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "antd", - "version": "0.8.0-beta6", + "version": "0.8.0-beta7", "stableVersion": "0.7.3", "title": "Ant Design", "description": "一个 UI 设计语言", @@ -36,7 +36,6 @@ "enter-animation": "~0.3.0", "gregorian-calendar": "~3.0.0", "gregorian-calendar-format": "~3.0.1", - "is-equal-shallow": "~0.1.3", "object-assign": "3.x", "rc-animate": "~1.2.0", "rc-calendar": "~3.15.0", diff --git a/style/components/tree.less b/style/components/tree.less index c55715aa9c..5e986edfe5 100644 --- a/style/components/tree.less +++ b/style/components/tree.less @@ -100,6 +100,9 @@ color: gray; } } + &-node-selected { + background-color: tint(@primary-color, 90%); + } &-icon__open { margin-right: 2px; vertical-align: top; diff --git a/webpack.config.min.js b/webpack.config.min.js index 9810452777..308e19e7b0 100644 --- a/webpack.config.min.js +++ b/webpack.config.min.js @@ -7,7 +7,6 @@ var config = require("./webpack.config.js"); config.plugins = [ new ExtractTextPlugin('[name].min.css'), - new webpack.IgnorePlugin(/xhr2/), new webpack.optimize.UglifyJsPlugin({ output: { ascii_only: true