"use strict";
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
const vue = require("vue");
const comp = require("../../ui/src/comp.js");
const dom = require("../../ui/src/dom.js");
require("../../ui/index.js");
const loading = require("../../loading/src/loading.js");
const XEUtils = require("xe-utils");
const config = require("../../../../@vxe-ui/core/es/src/config.js");
const useFns = require("../../../../@vxe-ui/core/es/src/useFns.js");
const event = require("../../../../@vxe-ui/core/es/src/event.js");
const VxeLayoutAsideComponent = comp.defineVxeComponent({
  name: "VxeLayoutAside",
  props: {
    width: [String, Number],
    collapsed: Boolean,
    collapseWidth: [String, Number],
    loading: Boolean,
    padding: Boolean,
    size: {
      type: String,
      default: () => config.getConfig().layoutAside.size || config.getConfig().size
    }
  },
  emits: [],
  setup(props, context) {
    const { slots, emit } = context;
    const xID = XEUtils.uniqueId();
    const refElem = vue.ref();
    const { computeSize } = useFns.useSize(props);
    const reactData = vue.reactive({});
    const refMaps = {
      refElem
    };
    const computeWrapperWidth = vue.computed(() => {
      const { width, collapsed, collapseWidth } = props;
      if (collapsed) {
        if (collapseWidth) {
          return dom.toCssUnit(collapseWidth);
        }
      } else {
        if (width) {
          return dom.toCssUnit(width);
        }
      }
      return "";
    });
    const computeMaps = {
      computeSize
    };
    const $xeLayoutAside = {
      xID,
      props,
      context,
      reactData,
      getRefMaps: () => refMaps,
      getComputeMaps: () => computeMaps
    };
    const dispatchEvent = (type, params, evnt) => {
      emit(type, event.createEvent(evnt, { $layoutAside: $xeLayoutAside }, params));
    };
    const layoutAsideMethods = {
      dispatchEvent
    };
    const layoutAsidePrivateMethods = {};
    Object.assign($xeLayoutAside, layoutAsideMethods, layoutAsidePrivateMethods);
    const renderVN = () => {
      const { width, collapsed, loading: loading$1, padding } = props;
      const wrapperWidth = computeWrapperWidth.value;
      const vSize = computeSize.value;
      const defaultSlot = slots.default;
      return vue.h("aside", {
        ref: refElem,
        class: ["vxe-layout-aside", {
          [`size--${vSize}`]: vSize,
          "is--padding": padding,
          "is--default-width": !width,
          "is--collapse": collapsed,
          "is--loading": loading$1
        }],
        style: wrapperWidth ? {
          width: wrapperWidth
        } : null
      }, [
        vue.h("div", {
          class: "vxe-layout-aside--inner"
        }, defaultSlot ? defaultSlot({}) : []),
        /**
         * 加载中
         */
        vue.h(loading.default, {
          class: "vxe-list-view--loading",
          modelValue: loading$1
        })
      ]);
    };
    vue.provide("$xeLayoutAside", $xeLayoutAside);
    $xeLayoutAside.renderVN = renderVN;
    return $xeLayoutAside;
  },
  render() {
    return this.renderVN();
  }
});
exports.default = VxeLayoutAsideComponent;
