remove velocity-anim

This commit is contained in:
yiminghe 2016-03-30 16:27:14 +08:00
parent 1fbfb67744
commit afdbe4544c
4 changed files with 36 additions and 36 deletions

View File

@ -1,44 +1,35 @@
let velocity; import cssAnimation from 'css-animation';
if (typeof document !== 'undefined' && typeof window !== 'undefined') {
velocity = require('velocity-animate');
}
function animate(node, show, transitionName, done) { function animate(node, show, done) {
let ok; let height;
return cssAnimation(node, 'ant-motion-collapse', {
function complete() { start() {
if (!ok) { if (!show) {
ok = true; node.style.height = `${node.offsetHeight}px`;
} else {
height = node.offsetHeight;
node.style.height = 0;
}
},
active() {
node.style.height = `${show ? height : 0}px`;
},
end() {
node.style.height = '';
done(); done();
} },
}
// Fix safari flash bug
/*eslint-disable */
node.style.display = show ? 'block' : 'none';
/*eslint-enable */
velocity(node, transitionName, {
duration: 240,
complete,
easing: 'easeInOutQuad'
}); });
return {
stop() {
velocity(node, 'finish');
complete();
}
};
} }
const animation = { const animation = {
enter(node, done) { enter(node, done) {
return animate(node, false, 'slideDown', done); return animate(node, true, done);
}, },
leave(node, done) { leave(node, done) {
return animate(node, true, 'slideUp', done); return animate(node, false, done);
}, },
appear(node, done) { appear(node, done) {
return animate(node, false, 'slideDown', done); return animate(node, true, done);
}, },
}; };

View File

@ -34,14 +34,14 @@
"dependencies": { "dependencies": {
"array-tree-filter": "~1.0.0", "array-tree-filter": "~1.0.0",
"classnames": "~2.2.0", "classnames": "~2.2.0",
"css-animation": "~1.1.0", "css-animation": "~1.2.0",
"gregorian-calendar": "~4.1.0", "gregorian-calendar": "~4.1.0",
"gregorian-calendar-format": "~4.1.0", "gregorian-calendar-format": "~4.1.0",
"rc-animate": "~2.0.2", "rc-animate": "~2.0.2",
"rc-calendar": "~5.4.0", "rc-calendar": "~5.4.0",
"rc-cascader": "~0.9.0", "rc-cascader": "~0.9.0",
"rc-checkbox": "~1.3.0", "rc-checkbox": "~1.3.0",
"rc-collapse": "~1.4.4", "rc-collapse": "~1.5.0",
"rc-dialog": "~5.4.0", "rc-dialog": "~5.4.0",
"rc-dropdown": "~1.4.3", "rc-dropdown": "~1.4.3",
"rc-form": "~0.14.0", "rc-form": "~0.14.0",
@ -67,7 +67,6 @@
"rc-upload": "~1.9.0", "rc-upload": "~1.9.0",
"rc-util": "~3.1.2", "rc-util": "~3.1.2",
"react-slick": "~0.11.0", "react-slick": "~0.11.0",
"velocity-animate": "~1.2.2",
"warning": "~2.1.0" "warning": "~2.1.0"
}, },
"devDependencies": { "devDependencies": {

View File

@ -12,6 +12,10 @@
border-radius: 3px; border-radius: 3px;
border: 1px solid @border-color-base; border: 1px solid @border-color-base;
&-anim-active {
transition: height .2s ease-out;
}
& > &-item { & > &-item {
border-top: 1px solid @border-color-base; border-top: 1px solid @border-color-base;
&:first-child { &:first-child {
@ -49,7 +53,6 @@
} }
&-content { &-content {
display: none;
overflow: hidden; overflow: hidden;
color: @text-color; color: @text-color;
padding: 0 16px; padding: 0 16px;
@ -60,8 +63,8 @@
padding-bottom: 16px; padding-bottom: 16px;
} }
&-active { &-inactive {
display: block; display: none;
} }
} }

View File

@ -29,6 +29,13 @@
} }
} }
.ant-motion-collapse {
overflow: hidden;
&-active {
transition: height .2s ease-out;
}
}
@import "motion/fade"; @import "motion/fade";
@import "motion/move"; @import "motion/move";
@import "motion/other"; @import "motion/other";