antd
Version:
An enterprise-class UI design language and React components implementation
57 lines (48 loc) • 1.45 kB
JavaScript
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = exports.getTransitionName = void 0;
// ================== Collapse Motion ==================
var getCollapsedHeight = function getCollapsedHeight() {
return {
height: 0,
opacity: 0
};
};
var getRealHeight = function getRealHeight(node) {
return {
height: node.scrollHeight,
opacity: 1
};
};
var getCurrentHeight = function getCurrentHeight(node) {
return {
height: node.offsetHeight
};
};
var skipOpacityTransition = function skipOpacityTransition(_, event) {
return (event === null || event === void 0 ? void 0 : event.deadline) === true || event.propertyName === 'height';
};
var collapseMotion = {
motionName: 'ant-motion-collapse',
onAppearStart: getCollapsedHeight,
onEnterStart: getCollapsedHeight,
onAppearActive: getRealHeight,
onEnterActive: getRealHeight,
onLeaveStart: getCurrentHeight,
onLeaveActive: getCollapsedHeight,
onAppearEnd: skipOpacityTransition,
onEnterEnd: skipOpacityTransition,
onLeaveEnd: skipOpacityTransition,
motionDeadline: 500
};
var getTransitionName = function getTransitionName(rootPrefixCls, motion, transitionName) {
if (transitionName !== undefined) {
return transitionName;
}
return "".concat(rootPrefixCls, "-").concat(motion);
};
exports.getTransitionName = getTransitionName;
var _default = collapseMotion;
exports["default"] = _default;
;