UNPKG

@aplus-frontend/antdv

Version:

Vue basic component library maintained based on ant-design-vue

45 lines (44 loc) 1.66 kB
"use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); Object.defineProperty(exports, "__esModule", { value: true }); exports.initMotion = void 0; var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")); const initMotionCommon = duration => ({ animationDuration: duration, animationFillMode: 'both' }); // FIXME: origin less code seems same as initMotionCommon. Maybe we can safe remove const initMotionCommonLeave = duration => ({ animationDuration: duration, animationFillMode: 'both' }); const initMotion = function (motionCls, inKeyframes, outKeyframes, duration) { let sameLevel = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false; const sameLevelPrefix = sameLevel ? '&' : ''; return { [` ${sameLevelPrefix}${motionCls}-enter, ${sameLevelPrefix}${motionCls}-appear `]: (0, _extends2.default)((0, _extends2.default)({}, initMotionCommon(duration)), { animationPlayState: 'paused' }), [`${sameLevelPrefix}${motionCls}-leave`]: (0, _extends2.default)((0, _extends2.default)({}, initMotionCommonLeave(duration)), { animationPlayState: 'paused' }), [` ${sameLevelPrefix}${motionCls}-enter${motionCls}-enter-active, ${sameLevelPrefix}${motionCls}-appear${motionCls}-appear-active `]: { animationName: inKeyframes, animationPlayState: 'running' }, [`${sameLevelPrefix}${motionCls}-leave${motionCls}-leave-active`]: { animationName: outKeyframes, animationPlayState: 'running', pointerEvents: 'none' } }; }; exports.initMotion = initMotion;