1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _cssAnimation = require('../../_util/css-animation');
var _cssAnimation2 = _interopRequireDefault(_cssAnimation);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function animate(node, show, transitionName, done) {
var height = void 0;
return (0, _cssAnimation2['default'])(node, transitionName, {
start: function start() {
if (!show) {
node.style.height = node.offsetHeight + 'px';
} else {
height = node.offsetHeight;
node.style.height = 0;
}
},
active: function active() {
node.style.height = (show ? height : 0) + 'px';
},
end: function end() {
node.style.height = '';
done();
}
});
}
function animation(prefixCls) {
return {
enter: function enter(node, done) {
return animate(node, true, prefixCls + '-anim', done);
},
leave: function leave(node, done) {
return animate(node, false, prefixCls + '-anim', done);
}
};
}
exports['default'] = animation;