'use strict';

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

var vue = require('vue');
var index = require('../../expand-menu/index.js');
require('./column-menu.vue.js');
require('./main-menu.vue.js');
var elementPlus = require('element-plus');
var mainMenu_vue_vue_type_script_setup_true_lang = require('./main-menu.vue2.js');
var columnMenu_vue_vue_type_script_setup_true_lang = require('./column-menu.vue2.js');

"use strict";
const _hoisted_1 = { class: "footer" };
const __default__ = vue.defineComponent({
  name: "me-menu"
});
var script = /* @__PURE__ */ vue.defineComponent({
  ...__default__,
  props: {
    mainMenuProps: { type: Object, required: true },
    columnMenuProps: { type: Object, required: true },
    width: { type: Number, required: false },
    show: { type: Boolean, required: false, default: true },
    menuStyle: { type: Object, required: false }
  },
  emits: ["mainMenuClick", "menuItemClick"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const emit = __emit;
    const menuExpanded = vue.ref(true);
    const menuRef = vue.ref();
    const mainMenuData = vue.computed(() => props.mainMenuProps.data);
    const columnMenuData = vue.computed(() => props.columnMenuProps.data || []);
    const menuStyle = vue.computed(() => {
      return {
        width: props.width + "px",
        ...props.menuStyle
      };
    });
    const onMainMenuClick = (item) => {
      emit("mainMenuClick", item);
    };
    const onMenuItemClick = (item) => {
      emit("menuItemClick", item);
    };
    const handleMenuExpand = (val) => {
      menuExpanded.value = val;
    };
    const dragbarVisible = vue.computed(() => {
      const isHide = columnMenuData.value?.every((item) => item.hideFlag);
      if (columnMenuData.value.length > 0 && !isHide) {
        menuExpanded.value = true;
        return true;
      } else {
        menuExpanded.value = false;
        return false;
      }
    });
    return (_ctx, _cache) => {
      return vue.openBlock(), vue.createElementBlock(
        vue.Fragment,
        null,
        [
          vue.createCommentVNode(" \u83DC\u5355\u5BB9\u5668 "),
          props.show ? (vue.openBlock(), vue.createElementBlock(
            "div",
            {
              key: 0,
              class: "me-menu",
              style: vue.normalizeStyle(menuStyle.value),
              ref_key: "menuRef",
              ref: menuRef
            },
            [
              vue.createVNode(mainMenu_vue_vue_type_script_setup_true_lang.default, vue.mergeProps({ onMainMenuClick }, props.mainMenuProps, { data: mainMenuData.value }), {
                logo: vue.withCtx(() => [
                  vue.renderSlot(_ctx.$slots, "logo")
                ]),
                _: 3
                /* FORWARDED */
              }, 16, ["data"]),
              vue.createVNode(vue.unref(elementPlus.ElScrollbar), {
                class: vue.normalizeClass(["aside-column-menu", {
                  "is-hide": !menuExpanded.value
                }]),
                style: vue.normalizeStyle({ width: props.columnMenuProps.width + "px" })
              }, {
                default: vue.withCtx(() => [
                  vue.createVNode(columnMenu_vue_vue_type_script_setup_true_lang.default, vue.mergeProps(props.columnMenuProps, {
                    data: columnMenuData.value,
                    onMenuItemClick
                  }), null, 16, ["data"])
                ]),
                _: 1
                /* STABLE */
              }, 8, ["class", "style"]),
              vue.createElementVNode("div", _hoisted_1, [
                vue.renderSlot(_ctx.$slots, "footer")
              ]),
              vue.withDirectives(vue.createVNode(vue.unref(index.MeExpandMenu), {
                target: menuRef.value,
                autoHide: "",
                onExpandChangeEvent: handleMenuExpand
              }, null, 8, ["target"]), [
                [vue.vShow, dragbarVisible.value]
              ])
            ],
            4
            /* STYLE */
          )) : vue.createCommentVNode("v-if", true)
        ],
        2112
        /* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
      );
    };
  }
});

exports.default = script;
//# sourceMappingURL=menu.vue2.js.map
