'use strict';

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

var vue = require('vue');
var iconsVue = require('@ant-design/icons-vue');

var LoadingIcon = /* @__PURE__ */ vue.defineComponent({
  compatConfig: {
    MODE: 3
  },
  name: "LoadingIcon",
  props: {
    prefixCls: String,
    loading: [Boolean, Object],
    existIcon: Boolean
  },
  setup(props) {
    return () => {
      const {
        existIcon,
        prefixCls,
        loading
      } = props;
      if (existIcon) {
        return vue.createVNode("span", {
          "class": `${prefixCls}-loading-icon`
        }, [vue.createVNode(iconsVue.LoadingOutlined, null, null)]);
      }
      const getCollapsedWidth = (node) => {
        if (node) {
          node.style.width = "0px";
          node.style.opacity = "0";
          node.style.transform = "scale(0)";
        }
      };
      const getRealWidth = (node) => {
        vue.nextTick(() => {
          if (node) {
            node.style.width = `${node.scrollWidth}px`;
            node.style.opacity = "1";
            node.style.transform = "scale(1)";
          }
        });
      };
      const resetStyle = (node) => {
        if (node && node.style) {
          node.style.width = null;
          node.style.opacity = null;
          node.style.transform = null;
        }
      };
      const visible = !!loading;
      return vue.createVNode(vue.Transition, {
        "name": `${prefixCls}-loading-icon-motion`,
        "onBeforeEnter": getCollapsedWidth,
        "onEnter": getRealWidth,
        "onAfterEnter": resetStyle,
        "onBeforeLeave": getRealWidth,
        "onLeave": (node) => {
          setTimeout(() => {
            getCollapsedWidth(node);
          });
        },
        "onAfterLeave": resetStyle
      }, {
        default: () => [visible ? vue.createVNode("span", {
          "class": `${prefixCls}-loading-icon`
        }, [vue.createVNode(iconsVue.LoadingOutlined, null, null)]) : null]
      });
    };
  }
});

exports.default = LoadingIcon;
//# sourceMappingURL=LoadingIcon.cjs.map
