'use strict';

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

var vue = require('vue');
var elementPlus = require('element-plus');
var index$1 = require('../../dot/index.js');
var index = require('../../svg-icon/index.js');
require('./components/badge.vue.js');
var badge_vue_vue_type_script_setup_true_lang = require('./components/badge.vue2.js');

"use strict";
const _hoisted_1 = {
  key: 0,
  class: "group"
};
const _hoisted_2 = { key: 0 };
const _hoisted_3 = { class: "menuIcon" };
const _hoisted_4 = { class: "menuTitle" };
const _hoisted_5 = {
  key: 0,
  class: "menuDot"
};
const _hoisted_6 = { key: 1 };
const _hoisted_7 = { class: "menuIcon" };
const _hoisted_8 = { class: "menuTitle" };
const _hoisted_9 = {
  key: 0,
  class: "menuDot"
};
const _hoisted_10 = { class: "menuIcon" };
const _hoisted_11 = { class: "menuTitle" };
const _hoisted_12 = {
  key: 0,
  class: "menuDot"
};
var script = /* @__PURE__ */ vue.defineComponent({
  __name: "column-menu-tree",
  props: {
    showGroup: { type: Boolean, required: false },
    item: { type: Object, required: true },
    show: { type: [Boolean, Function], required: false },
    router: { type: Boolean, required: false, default: false }
  },
  emits: ["menuItemClick"],
  setup(__props, { emit: __emit }) {
    const props = __props;
    const emits = __emit;
    const instance = vue.getCurrentInstance();
    const router = instance.appContext.config.globalProperties.$router;
    const showGroupContent = vue.ref(props.showGroup);
    const groupContentRef = vue.ref();
    let showLogic = (item) => {
      if (typeof props.show == "function") {
        return props.show(item);
      } else {
        return props.show;
      }
    };
    const handleGroupClick = () => {
      showGroupContent.value = !showGroupContent.value;
    };
    const menuClickHandler = (item) => {
      if (props.router && router) {
        if (item.meta.linkURL) {
          window.open(item.meta.linkURL);
          return;
        }
        if (item.meta.activeMenu != "") {
          item = item.children?.find((child) => child.id == item.meta.activeMenu) || item;
        }
        router.push(item.meta.path);
      }
      emits("menuItemClick", item);
    };
    const onEnter = (el, done) => {
      el.style.height = "0";
      el.offsetHeight;
      const contentHeight = groupContentRef.value.scrollHeight + "px";
      el.style.height = contentHeight;
    };
    const onAfterEnter = (el) => {
      el.style.height = "auto";
    };
    const onLeave = (el, done) => {
      const contentHeight = groupContentRef.value.scrollHeight + "px";
      el.style.height = contentHeight;
      el.offsetHeight;
      el.style.height = "0";
    };
    const onAfterLeave = (el) => {
      el.style.height = "";
    };
    return (_ctx, _cache) => {
      const _component_column_menu_tree = vue.resolveComponent("column-menu-tree", true);
      return vue.openBlock(), vue.createElementBlock(
        vue.Fragment,
        null,
        [
          vue.createCommentVNode(" \u5206\u7EC4\u83DC\u5355\u9879 "),
          __props.item.meta?.type === "group" && !__props.item.hideFlag ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_1, [
            vue.createElementVNode("div", {
              class: "title",
              onClick: handleGroupClick
            }, [
              !showGroupContent.value ? (vue.openBlock(), vue.createBlock(vue.unref(index.MeSvgIcon), {
                key: 0,
                name: __props.item.icon || "ri-arrow-right-s-fill"
              }, null, 8, ["name"])) : (vue.openBlock(), vue.createBlock(vue.unref(index.MeSvgIcon), {
                key: 1,
                name: "ri-arrow-down-s-fill"
              })),
              vue.createElementVNode(
                "span",
                null,
                vue.toDisplayString(__props.item.title),
                1
                /* TEXT */
              )
            ]),
            vue.createVNode(vue.Transition, {
              css: false,
              onEnter,
              onAfterEnter,
              onLeave,
              onAfterLeave
            }, {
              default: vue.withCtx(() => [
                __props.item.children?.length ? vue.withDirectives((vue.openBlock(), vue.createElementBlock(
                  "div",
                  {
                    key: 0,
                    ref_key: "groupContentRef",
                    ref: groupContentRef,
                    class: "group-content"
                  },
                  [
                    (vue.openBlock(true), vue.createElementBlock(
                      vue.Fragment,
                      null,
                      vue.renderList(__props.item.children, (children) => {
                        return vue.openBlock(), vue.createBlock(_component_column_menu_tree, {
                          onMenuItemClick: menuClickHandler,
                          show: vue.unref(showLogic)(__props.item),
                          key: __props.item.id,
                          item: children
                        }, null, 8, ["show", "item"]);
                      }),
                      128
                      /* KEYED_FRAGMENT */
                    ))
                  ],
                  512
                  /* NEED_PATCH */
                )), [
                  [vue.vShow, showGroupContent.value]
                ]) : vue.createCommentVNode("v-if", true)
              ]),
              _: 1
              /* STABLE */
            })
          ])) : !__props.item.hideFlag && vue.unref(showLogic)(__props.item) ? (vue.openBlock(), vue.createElementBlock(
            vue.Fragment,
            { key: 1 },
            [
              vue.createCommentVNode(" \u5E38\u89C4\u83DC\u5355\u9879  "),
              vue.createCommentVNode(" \u591A\u83DC\u5355-\u6709\u5B50\u680F\u76EE "),
              __props.item.children?.length && __props.item.hideFlag == false && !__props.item.meta.hideChildrenMenu ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_2, [
                (vue.openBlock(), vue.createBlock(vue.unref(elementPlus.ElSubMenu), {
                  style: { "padding-top": "6px" },
                  index: __props.item.id,
                  key: __props.item.id
                }, {
                  title: vue.withCtx(() => [
                    vue.createCommentVNode(" Icon "),
                    vue.createElementVNode("span", _hoisted_3, [
                      vue.createVNode(vue.unref(index.MeSvgIcon), {
                        name: __props.item.icon
                      }, null, 8, ["name"])
                    ]),
                    vue.createCommentVNode(" Title "),
                    vue.createElementVNode(
                      "span",
                      _hoisted_4,
                      vue.toDisplayString(__props.item.title),
                      1
                      /* TEXT */
                    ),
                    vue.createCommentVNode("\u5FBD\u7AE0 "),
                    vue.createVNode(badge_vue_vue_type_script_setup_true_lang.default, {
                      meta: __props.item.meta,
                      type: __props.item.meta.badgeType,
                      color: __props.item.meta.badgeColor,
                      text: __props.item.meta.badge
                    }, null, 8, ["meta", "type", "color", "text"]),
                    vue.createCommentVNode("\u5706\u70B9\u53D1\u5149 "),
                    __props.item.meta.dot ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_5, [
                      vue.createVNode(vue.unref(index$1.MeDot))
                    ])) : vue.createCommentVNode("v-if", true)
                  ]),
                  default: vue.withCtx(() => [
                    (vue.openBlock(true), vue.createElementBlock(
                      vue.Fragment,
                      null,
                      vue.renderList(__props.item.children, (children) => {
                        return vue.openBlock(), vue.createBlock(_component_column_menu_tree, {
                          onMenuItemClick: menuClickHandler,
                          show: vue.unref(showLogic)(__props.item),
                          key: __props.item.id,
                          item: children
                        }, null, 8, ["show", "item"]);
                      }),
                      128
                      /* KEYED_FRAGMENT */
                    ))
                  ]),
                  _: 1
                  /* STABLE */
                }, 8, ["index"]))
              ])) : vue.createCommentVNode("v-if", true),
              vue.createCommentVNode(" \u591A\u83DC\u5355-\u8BBE\u7F6E\u4E86\u9690\u85CF\u5B50\u83DC\u5355 "),
              __props.item.children?.length && __props.item.hideFlag == false && __props.item.meta.hideChildrenMenu ? (vue.openBlock(), vue.createElementBlock("div", _hoisted_6, [
                (vue.openBlock(), vue.createBlock(vue.unref(elementPlus.ElMenuItem), {
                  index: `${__props.item.id}`,
                  key: __props.item.id,
                  onClick: _cache[0] || (_cache[0] = ($event) => menuClickHandler(__props.item))
                }, {
                  default: vue.withCtx(() => [
                    vue.createCommentVNode(" Icon "),
                    vue.createElementVNode("span", _hoisted_7, [
                      vue.createVNode(vue.unref(index.MeSvgIcon), {
                        name: __props.item.icon
                      }, null, 8, ["name"])
                    ]),
                    vue.createCommentVNode(" Title "),
                    vue.createElementVNode(
                      "span",
                      _hoisted_8,
                      vue.toDisplayString(__props.item.title),
                      1
                      /* TEXT */
                    ),
                    vue.createCommentVNode("\u5FBD\u7AE0 "),
                    vue.createVNode(badge_vue_vue_type_script_setup_true_lang.default, {
                      meta: __props.item.meta,
                      type: __props.item.meta.badgeType,
                      color: __props.item.meta.badgeColor,
                      text: __props.item.meta.badge
                    }, null, 8, ["meta", "type", "color", "text"]),
                    vue.createCommentVNode("\u5706\u70B9\u53D1\u5149 "),
                    __props.item.meta.dot ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_9, [
                      vue.createVNode(vue.unref(index$1.MeDot))
                    ])) : vue.createCommentVNode("v-if", true)
                  ]),
                  _: 1
                  /* STABLE */
                }, 8, ["index"]))
              ])) : vue.createCommentVNode("v-if", true),
              vue.createCommentVNode(" \u5355\u83DC\u5355 "),
              !__props.item.children?.length && __props.item.hideFlag == false ? (vue.openBlock(), vue.createElementBlock("div", {
                key: __props.item.id
              }, [
                (vue.openBlock(), vue.createBlock(vue.unref(elementPlus.ElMenuItem), {
                  index: `${__props.item.id}`,
                  key: __props.item.id,
                  onClick: _cache[1] || (_cache[1] = ($event) => menuClickHandler(__props.item))
                }, {
                  default: vue.withCtx(() => [
                    vue.createCommentVNode(" Icon "),
                    vue.createElementVNode("span", _hoisted_10, [
                      vue.createVNode(vue.unref(index.MeSvgIcon), {
                        name: __props.item.icon
                      }, null, 8, ["name"])
                    ]),
                    vue.createCommentVNode(" Title "),
                    vue.createElementVNode(
                      "span",
                      _hoisted_11,
                      vue.toDisplayString(__props.item.title),
                      1
                      /* TEXT */
                    ),
                    vue.createCommentVNode("\u5FBD\u7AE0 "),
                    vue.createVNode(badge_vue_vue_type_script_setup_true_lang.default, {
                      meta: __props.item.meta,
                      type: __props.item.meta.badgeType,
                      text: __props.item.meta.badge,
                      color: __props.item.meta.badgeColor
                    }, null, 8, ["meta", "type", "text", "color"]),
                    vue.createCommentVNode("\u5706\u70B9\u53D1\u5149 "),
                    __props.item.meta.dot ? (vue.openBlock(), vue.createElementBlock("span", _hoisted_12, [
                      vue.createVNode(vue.unref(index$1.MeDot))
                    ])) : vue.createCommentVNode("v-if", true)
                  ]),
                  _: 1
                  /* STABLE */
                }, 8, ["index"]))
              ])) : vue.createCommentVNode("v-if", true)
            ],
            64
            /* STABLE_FRAGMENT */
          )) : vue.createCommentVNode("v-if", true)
        ],
        2112
        /* STABLE_FRAGMENT, DEV_ROOT_FRAGMENT */
      );
    };
  }
});

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