'use strict';

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

var vue = require('vue');
var vueRouter = require('vue-router');
var elementPlus = require('element-plus');
var index = require('../../svg-icon/index.js');

"use strict";
const _hoisted_1 = { class: "me-more-dropdown" };
const _hoisted_2 = { style: { "cursor": "pointer", "height": "fit-content" } };
const __default__ = vue.defineComponent({
  name: "me-more-dropdown"
});
var script = /* @__PURE__ */ vue.defineComponent({
  ...__default__,
  props: {
    data: { type: Array, required: true, default: () => [] },
    menuIcon: { type: String, required: false, default: "ri-more-2-line" },
    placement: { type: String, required: false, default: "bottom-end" },
    disableTransitions: { type: Boolean, required: false, default: false },
    buttonStyle: { type: String, required: false },
    style: { type: String, required: false },
    activeLabel: { type: String, required: false }
  },
  setup(__props) {
    const props = __props;
    const router = vueRouter.useRouter();
    const onClick = (e, item) => {
      const { toPath, onClick: onClick2 } = item;
      if (onClick2) onClick2(e);
      if (toPath && router) router.push(toPath);
    };
    return (_ctx, _cache) => {
      return vue.openBlock(), vue.createElementBlock("div", _hoisted_1, [
        vue.createVNode(vue.unref(elementPlus.ElDropdown), vue.mergeProps({
          "hide-on-click": true,
          placement: __props.placement,
          trigger: "click"
        }, _ctx.$attrs, { style: __props.style }), {
          dropdown: vue.withCtx(() => [
            vue.createVNode(vue.unref(elementPlus.ElDropdownMenu), null, {
              default: vue.withCtx(() => [
                (vue.openBlock(true), vue.createElementBlock(
                  vue.Fragment,
                  null,
                  vue.renderList(__props.data, (item, index) => {
                    return vue.openBlock(), vue.createElementBlock(
                      vue.Fragment,
                      { key: index },
                      [
                        !item.hidden ? (vue.openBlock(), vue.createBlock(vue.unref(elementPlus.ElDropdownItem), {
                          key: 0,
                          divided: item.divided,
                          disabled: item.disabled,
                          onClick: ($event) => onClick($event, item),
                          style: vue.normalizeStyle({ color: item.label === __props.activeLabel ? "var(--el-color-primary)" : "" })
                        }, {
                          default: vue.withCtx(() => [
                            vue.createTextVNode(
                              vue.toDisplayString(item.label),
                              1
                              /* TEXT */
                            )
                          ]),
                          _: 2
                          /* DYNAMIC */
                        }, 1032, ["divided", "disabled", "onClick", "style"])) : vue.createCommentVNode("v-if", true)
                      ],
                      64
                      /* STABLE_FRAGMENT */
                    );
                  }),
                  128
                  /* KEYED_FRAGMENT */
                ))
              ]),
              _: 1
              /* STABLE */
            })
          ]),
          default: vue.withCtx(() => [
            vue.createElementVNode("div", _hoisted_2, [
              vue.renderSlot(_ctx.$slots, "default", {}, () => [
                vue.createElementVNode(
                  "div",
                  {
                    style: vue.normalizeStyle(__props.buttonStyle),
                    class: vue.normalizeClass([{ transition: !__props.disableTransitions }, "button flex-center"])
                  },
                  [
                    vue.createVNode(vue.unref(index.MeSvgIcon), {
                      class: "icon",
                      name: __props.menuIcon
                    }, null, 8, ["name"])
                  ],
                  6
                  /* CLASS, STYLE */
                )
              ])
            ])
          ]),
          _: 3
          /* FORWARDED */
        }, 16, ["placement", "style"])
      ]);
    };
  }
});

exports.default = script;
//# sourceMappingURL=more-dropdown.vue2.js.map
