'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var vue = require('vue');
var type = require('../type.js');

const SelectPlacements = type.tuple("bottomLeft", "bottomRight", "topLeft", "topRight");
const getTransitionDirection = (placement) => {
  if (placement !== void 0 && (placement === "topLeft" || placement === "topRight"))
    return "slide-down";
  return "slide-up";
};
const getTransitionProps = (transitionName, opt = {}) => {
  const transitionProps = transitionName ? {
    name: transitionName,
    appear: true,
    // type: 'animation',
    // appearFromClass: `${transitionName}-appear ${transitionName}-appear-prepare`,
    // appearActiveClass: `antd-vue-base-transtion`,
    // appearToClass: `${transitionName}-appear ${transitionName}-appear-active`,
    enterFromClass: `${transitionName}-enter ${transitionName}-enter-prepare ${transitionName}-enter-start`,
    enterActiveClass: `${transitionName}-enter ${transitionName}-enter-prepare`,
    enterToClass: `${transitionName}-enter ${transitionName}-enter-active`,
    leaveFromClass: ` ${transitionName}-leave`,
    leaveActiveClass: `${transitionName}-leave ${transitionName}-leave-active`,
    leaveToClass: `${transitionName}-leave ${transitionName}-leave-active`,
    ...opt
  } : {
    css: false,
    ...opt
  };
  return transitionProps;
};
const getTransitionGroupProps = (transitionName, opt = {}) => {
  const transitionProps = transitionName ? {
    name: transitionName,
    appear: true,
    // appearFromClass: `${transitionName}-appear ${transitionName}-appear-prepare`,
    appearActiveClass: `${transitionName}`,
    appearToClass: `${transitionName}-appear ${transitionName}-appear-active`,
    enterFromClass: `${transitionName}-appear ${transitionName}-enter ${transitionName}-appear-prepare ${transitionName}-enter-prepare`,
    enterActiveClass: `${transitionName}`,
    enterToClass: `${transitionName}-enter ${transitionName}-appear ${transitionName}-appear-active ${transitionName}-enter-active`,
    leaveActiveClass: `${transitionName} ${transitionName}-leave`,
    leaveToClass: `${transitionName}-leave-active`,
    ...opt
  } : {
    css: false,
    ...opt
  };
  return transitionProps;
};
const getCollapsedHeight = () => ({
  height: 0,
  opacity: 0
});
const getRealHeight = (node) => ({
  height: `${node.scrollHeight}px`,
  opacity: 1
});
const getCurrentHeight = (node) => ({
  height: `${node.offsetHeight}px`
});
const collapseMotion = (name = "ant-motion-collapse", style, className) => {
  return {
    name,
    appear: true,
    css: true,
    onBeforeEnter: (node) => {
      className.value = name;
      style.value = getCollapsedHeight(node);
    },
    onEnter: (node) => {
      vue.nextTick(() => {
        style.value = getRealHeight(node);
      });
    },
    onAfterEnter: () => {
      className.value = "";
      style.value = {};
    },
    onBeforeLeave: (node) => {
      className.value = name;
      style.value = getCurrentHeight(node);
    },
    onLeave: (node) => {
      setTimeout(() => {
        style.value = getCollapsedHeight(node);
      });
    },
    onAfterLeave: () => {
      className.value = "";
      style.value = {};
    }
  };
};
const getTransitionName = (rootPrefixCls, motion, transitionName) => {
  if (transitionName !== void 0)
    return transitionName;
  return `${rootPrefixCls}-${motion}`;
};

Object.defineProperty(exports, 'Transition', {
  enumerable: true,
  get: function () { return vue.Transition; }
});
Object.defineProperty(exports, 'TransitionGroup', {
  enumerable: true,
  get: function () { return vue.TransitionGroup; }
});
Object.defineProperty(exports, 'default', {
  enumerable: true,
  get: function () { return vue.Transition; }
});
exports.collapseMotion = collapseMotion;
exports.getTransitionDirection = getTransitionDirection;
exports.getTransitionGroupProps = getTransitionGroupProps;
exports.getTransitionName = getTransitionName;
exports.getTransitionProps = getTransitionProps;
//# sourceMappingURL=transition.js.map
