1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- "use strict";
- Object.defineProperty(exports, "__esModule", {
- value: true
- });
- exports.getTransitionName = exports.default = void 0;
- var _configProvider = require("../config-provider");
- // ================== Collapse Motion ==================
- const getCollapsedHeight = () => ({
- height: 0,
- opacity: 0
- });
- const getRealHeight = node => {
- const {
- scrollHeight
- } = node;
- return {
- height: scrollHeight,
- opacity: 1
- };
- };
- const getCurrentHeight = node => ({
- height: node ? node.offsetHeight : 0
- });
- const skipOpacityTransition = (_, event) => (event === null || event === void 0 ? void 0 : event.deadline) === true || event.propertyName === 'height';
- const initCollapseMotion = (rootCls = _configProvider.defaultPrefixCls) => ({
- motionName: `${rootCls}-motion-collapse`,
- onAppearStart: getCollapsedHeight,
- onEnterStart: getCollapsedHeight,
- onAppearActive: getRealHeight,
- onEnterActive: getRealHeight,
- onLeaveStart: getCurrentHeight,
- onLeaveActive: getCollapsedHeight,
- onAppearEnd: skipOpacityTransition,
- onEnterEnd: skipOpacityTransition,
- onLeaveEnd: skipOpacityTransition,
- motionDeadline: 500
- });
- const _SelectPlacements = ['bottomLeft', 'bottomRight', 'topLeft', 'topRight'];
- const getTransitionName = (rootPrefixCls, motion, transitionName) => {
- if (transitionName !== undefined) {
- return transitionName;
- }
- return `${rootPrefixCls}-${motion}`;
- };
- exports.getTransitionName = getTransitionName;
- var _default = exports.default = initCollapseMotion;
|