'use strict';

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

var vue = require('vue');
require('./column-menu-tree.vue.js');
var elementPlus = require('element-plus');
var columnMenuTree_vue_vue_type_script_setup_true_lang = require('./column-menu-tree.vue2.js');

"use strict";
const _hoisted_1 = { class: "me-column-menu" };
const __default__ = vue.defineComponent({
  name: "me-column-menu"
});
var script = /* @__PURE__ */ vue.defineComponent({
  ...__default__,
  props: {
    data: { type: Array, required: true, default: () => [] },
    router: { type: Boolean, required: true, default: false },
    width: { type: Number, required: false, default: 200 },
    activeId: { type: String, required: false },
    show: { type: [Boolean, Function], required: false },
    padding: { type: Number, required: false, default: 10 },
    theme: { type: String, required: false, default: "light" },
    style: { type: Object, required: false },
    mode: { type: String, required: true },
    defaultActive: { type: String, required: false },
    defaultOpeneds: { type: null, required: false },
    uniqueOpened: { type: Boolean, required: false },
    menuTrigger: { type: String, required: false },
    collapse: { type: Boolean, required: false },
    backgroundColor: { type: String, required: false },
    textColor: { type: String, required: false },
    activeTextColor: { type: String, required: false },
    closeOnClickOutside: { type: Boolean, required: false },
    collapseTransition: { type: Boolean, required: false },
    ellipsis: { type: Boolean, required: false },
    popperOffset: { type: Number, required: false },
    ellipsisIcon: { type: null, required: false },
    popperEffect: { type: null, required: false },
    popperClass: { type: String, required: false },
    popperStyle: { type: null, required: false },
    showTimeout: { type: Number, required: false },
    hideTimeout: { type: Number, required: false },
    persistent: { type: Boolean, required: false }
  },
  emits: ["menu-item-click"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const emits = __emit;
    const activeId = vue.computed(() => {
      return props.activeId || "";
    });
    const columnMenuStyle = vue.computed(() => {
      return { ...props.style, width: props.width + "px", padding: props.padding + "px" };
    });
    const onMenuItemClick = (menuItem) => {
      emits("menu-item-click", menuItem);
    };
    let hasActiveMenuItem = (data) => {
      if (data.id == props.activeId) {
        return true;
      }
      function d(data2) {
        if (data2?.children) {
          for (let i = 0; i < data2.children.length; i++) {
            const element = data2.children[i];
            if (element?.id == props.activeId) {
              return true;
            } else {
              return d(element);
            }
          }
        } else {
          return false;
        }
      }
      return d(data);
    };
    return (_ctx, _cache) => {
      return vue.openBlock(), vue.createElementBlock("div", _hoisted_1, [
        __props.data.length ? (vue.openBlock(), vue.createBlock(vue.unref(elementPlus.ElMenu), vue.mergeProps({
          key: 0,
          "default-active": activeId.value,
          style: [{}, columnMenuStyle.value]
        }, _ctx.$attrs), {
          default: vue.withCtx(() => [
            (vue.openBlock(true), vue.createElementBlock(
              vue.Fragment,
              null,
              vue.renderList(__props.data, (menuItem) => {
                return vue.openBlock(), vue.createBlock(columnMenuTree_vue_vue_type_script_setup_true_lang.default, {
                  item: menuItem,
                  key: menuItem.id,
                  show: __props.show,
                  router: __props.router,
                  showGroup: vue.unref(hasActiveMenuItem)(menuItem),
                  onMenuItemClick
                }, null, 8, ["item", "show", "router", "showGroup"]);
              }),
              128
              /* KEYED_FRAGMENT */
            ))
          ]),
          _: 1
          /* STABLE */
        }, 16, ["default-active", "style"])) : vue.createCommentVNode("v-if", true)
      ]);
    };
  }
});

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